Skip to content
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

core/excerpt-block - Missing </div> in render_block_core_post_excerpt() when showMoreOnNewLine #26581

Closed
bobbingwide opened this issue Oct 29, 2020 · 0 comments · Fixed by #26806
Labels
[Block] Post Excerpt Affects the Post Excerpt Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Bug An existing feature does not function as intended

Comments

@bobbingwide
Copy link
Contributor

bobbingwide commented Oct 29, 2020

Describe the bug
I'm using the post-excerpt block in a query-loop in an experimental FSE theme.
I noticed that the background styling had extended to subsequent sections of the output.
The generated HTML was missing the </div> tag.

A clear and concise description of what the bug is.

To reproduce
Steps to reproduce the behavior:

  1. In a Full Site Editing theme create a home.html template file containing the post-excerpt block
<!-- wp:query-loop -->
<!-- wp:post-excerpt -->
<!-- wp:post-excerpt /-->
  1. View the blog posts.
  2. Inspect the output.

The generated HTML for an excerpt will be something like this

<div class=&quot;wp-block-post-excerpt&quot;>
<p class="wp-block-post-excerpt__excerpt">
Twenty Twenty-One is a blank canvas for your ideas and it makes the block editor your best brush. With new block patterns, which allow you to create a beautiful layout in a matter of seconds, this theme’s soft colors and eye-catching — yet timeless — design will let your work shine. Take it for a [&hellip;]
</p>
<p class="wp-block-post-excerpt__more-text"></p>

Expected behavior
There should be </div> for each excerpt.

Screenshots
Before:
image

After applying the fix I took the opportunity to get rid of the greeny background

image

Editor version (please complete the following information):

  • WordPress version: [e.g: 5.3.2] 5.5.1
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? [e.g: "gutenberg plugin", "default"] 9.2.2 or latest extract from the repo.
  • If the Gutenberg plugin is installed, which version is it? [e.g., 7.6]

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows
  • Browser [e.g. chrome, safari] Chrome
  • Version [e.g. 22] 86.0.4240.111 (Official Build) (64-bit)

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Suggested fix:
Append </div> to line 39 of post-excerpt.php

if ( ! isset( $attributes['showMoreOnNewLine'] ) || $attributes['showMoreOnNewLine'] ) {
		$output .= '</p>' . '<p class="wp-block-post-excerpt__more-text">' . $more_text . '</p></div>';
@ntsekouras ntsekouras self-assigned this Nov 2, 2020
@ntsekouras ntsekouras added [Block] Post Excerpt Affects the Post Excerpt Block [Type] Bug An existing feature does not function as intended labels Nov 2, 2020
@youknowriad youknowriad added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Nov 2, 2020
@ntsekouras ntsekouras removed their assignment Nov 2, 2020
bobbingwide added a commit to bobbingwide/gutenberg that referenced this issue Nov 6, 2020
bobbingwide added a commit to bobbingwide/gutenberg that referenced this issue Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Excerpt Affects the Post Excerpt Block Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Bug An existing feature does not function as intended
Projects
None yet
3 participants