-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix duotone on parallax/repeated featured image cover blocks #65929
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
/* | ||
* Inserts the featured image between the (1st) cover 'background' `span` and 'inner_container' `div`, | ||
* and removes eventual whitespace characters between the two (typically introduced at template level) | ||
*/ | ||
$inner_container_start = '/<div\b[^>]+wp-block-cover__inner-container[\s|"][^>]*>/U'; | ||
if ( 1 === preg_match( $inner_container_start, $content, $matches, PREG_OFFSET_CAPTURE ) ) { | ||
$offset = $matches[0][1]; | ||
$content = substr( $content, 0, $offset ) . $image . substr( $content, $offset ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved from L37-L45 above as both branches of the conditional need to insert content in the same place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed on a pairing call. Tested with various combinations of the cover block and confirmed this fixes the issue and aligns editor and frontend HTML output.
Co-authored-by: ajlende <ajlende@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: mrfoxtalbot <mrfoxtalbot@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: iamtakashi <iamtakashi@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org> Co-authored-by: henriqueiamarino <iamarinoh@git.wordpress.org>
I just cherry-picked this PR to the wp/6.7 branch to get it included in the next release: 1774792 |
…ss#65929) Co-authored-by: ajlende <ajlende@git.wordpress.org> Co-authored-by: jeryj <jeryj@git.wordpress.org> Co-authored-by: mrfoxtalbot <mrfoxtalbot@git.wordpress.org> Co-authored-by: jordesign <jordesign@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: iamtakashi <iamtakashi@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org> Co-authored-by: henriqueiamarino <iamarinoh@git.wordpress.org>
What?
Updates the cover block to render a
<div>
background when using featured images.The best way to review this is to compare with the cover block's
save
function as the newly added code should mirror that when a featured image is used.Why?
Fixes #50828
Cover blocks using featured images didn't pick up duotone because they weren't using an element for the featured image.
How?
Generate a
<div>
instead of settingbackground-image
for cover blocks using featured images.Testing Instructions
Testing Instructions for Keyboard
N/A
Screenshots or screencast
Before
After