Site logo

Archived topic

Custom Excerpt that ignores the MORE tag

9 replies · Started by Jay on September 17, 2020

Viewing posts 1–10 of 10

Hello team,

I was wondering if there's a way to make the excerpt used in the Blog module ignore the MORE tag. I have my category archives setup with the masonry layout, and it works great if the excerpt shows x amount of characters from all posts - but some were written with the MORE tag, at which point the excerpt shows more. Here's an example: https://www.versluis.com/tag/zbrush/

The first post in the list is much longer, and I'd love for it to shortened to 55 characters like the other posts, without having to remove the MORE tag from every post. I'd like to preserve any embedded images though.

I tried crafting a custom excerpt, but had no luck ignoring the MORE tag. Is there a built-in GeneratePress function I can use to make this happen?

Hi Leo, thanks - that did indeed shorten the excerpt, however my images are also stripped out. I'm looking for a way to avoid that in the process.

Unfortunately you cannot have both.

Isn't there a way to take the_content(), count 55 words and spit out the rest, then print that?

Sorry what?

If you use the word count excerpt option in the customizer, then the HTML (images, text decoration etc) are ignored.

I understand that. I'm assuming GeneratePress either serves this via the_content() or the_excerpt() functions. I'm trying to find a way to use whatever comes out of the_content(), ignoring the MORE tag, and shortening that.

Is there a filter I can use after content is presented on archive pages so I can amend it?

Sorry to have troubled you.

This archived topic is closed to new replies.