Skip to content

fix the first query item doesn't display except#2875

Merged
outdoor2kode merged 2 commits intotrunkfrom
2682-some-lessons-dont-display-excerpt
Sep 5, 2024
Merged

fix the first query item doesn't display except#2875
outdoor2kode merged 2 commits intotrunkfrom
2682-some-lessons-dont-display-excerpt

Conversation

@outdoor2kode
Copy link
Copy Markdown
Contributor

Fixes #2682

It appears that the first post result of a query doesn't render an automatically generated excerpt due to an ordering issue or because get_the_excerpt is not being called. The automatic excerpt will only be generated after a get_the_excerpt call.

I couldn't find a relevant hook to solve this in the source code for the post-template block and post-excerpt block, so a get_the_excpert is added at the start.

Screenshots
Tested in the sandboxed environment, and everything looks fine. I also went through 20 pages, and they look good.

Screenshot 2024-09-06 at 05 05 57
Screenshot 2024-09-06 at 05 06 17

@outdoor2kode outdoor2kode self-assigned this Sep 5, 2024
@outdoor2kode outdoor2kode added [Type] Bug Something isn't working on the Learn website. [Component] Learn Theme Website development issues related to the Learn theme. labels Sep 5, 2024
* Inserter: no
*/

get_the_excerpt();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
get_the_excerpt();
// Workaround for the first lesson in the grid not having an automatic excerpt generated
get_the_excerpt();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and this works for me, so I think it's good to merge as a workaround, with a comment. I think it would still be good to understand where this is failing though, and potentially raise a Gutenberg bug.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2ebf0f6

Yeah, I spent some time looking into it, but couldn't find what part is causing the issue. There isn't any related discussion in Gutenberg either. Have already spent more time on this than expected, so just go with a workaround. I'll look into further the flow for this part in Gutenberg, and still can't figure it out, I'll open a ticket.

@outdoor2kode outdoor2kode merged commit 80b006c into trunk Sep 5, 2024
@outdoor2kode outdoor2kode deleted the 2682-some-lessons-dont-display-excerpt branch September 5, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Component] Learn Theme Website development issues related to the Learn theme. [Type] Bug Something isn't working on the Learn website.

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Bug: Some lessons don't display automatic excerpts

2 participants