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

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

Merged
merged 2 commits into from
Sep 5, 2024

Conversation

renintw
Copy link
Contributor

@renintw renintw commented Sep 5, 2024

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

@renintw renintw self-assigned this Sep 5, 2024
@renintw renintw 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
@renintw renintw added this to the Learning Pathways Post-launch milestone Sep 5, 2024
@@ -5,6 +5,8 @@
* Inserter: no
*/

get_the_excerpt();
Copy link
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
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
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.

@renintw renintw merged commit 80b006c into trunk Sep 5, 2024
1 check passed
@renintw renintw 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