Site logo

Archived topic

Excerpt only shows headings on pages

5 replies · Started by Joey on August 2, 2022

Viewing posts 1–6 of 6

I have a quick question. I use excerpts on GenerateBlock queries. It works well for posts, and takes the body of the post for the excerpt for the length I specify. The issue is when I try to use query excerpts for pages—in this case it only shows the headings I have on the page (H2, H3, etc.), not the body. It doesn't show H1. Do you know why it's doing this?

I can add customized excerpts on pages with this php:
add_post_type_support( 'page', 'excerpt' );

But when I do that, 1) I have to copy and paste the entire body into the excerpt, and 2) I can't have different excerpt lengths for different queries (for example, the author bio and the search function on the website).

No big deal, but just wondering if you knew anything about this. Thanks.

Hi Joey,

How are you “querying” the excerpt?

Can you provide the link to where you’re implementing this?

Hi Fenando,

I created a query loop. I put a link below with the problem, but I think I found the issue. The body of the pages I'm trying to get excerpts from are inside a GenerateBlocks grid—apparently that's why they aren't showing up. When I write in the normal part of the page, or even within GenerateBlocks containers, it shows up in the excerpt.

So I don't know of a way to reorder those pages without grids—maybe custom excerpts is the only way to do it? I was just looking for a way to control the excerp length, since sometimes I post short bios at the bottom of posts too. Thanks for your quick reply.

I see. It might be best to use custom excerpts indeed. You’re welcome Joey!

This post explains it really well, in case anyone else has the issue:

If your page starts with a GenerateBlocks grid, nested containers, or a headline inside a container then the excerpt that WordPress auto-generates is blank.

Apparently nested containers don't pick up the excerpt, but until WordPress adjusts the issue there's no fix. Thank you Fernando, I hadn't seen the other post—sorry for repeating topics.

I see. Good find! You’re welcome Joey!

This archived topic is closed to new replies.