- This topic has 9 replies, 2 voices, and was last updated 4 months, 1 week ago by
Leo.
-
AuthorPosts
-
September 17, 2020 at 7:29 am #1447128
Jay
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?
September 17, 2020 at 8:06 am #1447329Leo
StaffCustomer SupportHi there,
This should help:
https://generatepress.com/forums/topic/is-it-possible-to-make-gp-to-ignore-more-tag/#post-875026Adding PHP: https://docs.generatepress.com/article/adding-php/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 11:46 am #1447626Jay
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.
September 17, 2020 at 11:57 am #1447633Leo
StaffCustomer SupportUnfortunately you cannot have both.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 1:06 pm #1447717Jay
Isn’t there a way to take the_content(), count 55 words and spit out the rest, then print that?
September 17, 2020 at 1:08 pm #1447721Leo
StaffCustomer SupportSorry what?
If you use the word count excerpt option in the customizer, then the HTML (images, text decoration etc) are ignored.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 1:27 pm #1447733Jay
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?
September 17, 2020 at 1:30 pm #1447739Leo
StaffCustomer SupportGP simply uses the_excerpt() from WordPress for this function:
https://github.com/tomusborne/generatepress/blob/6933da4f9a85e183bcf8485836339043dfc4a650/content.php#L60
https://developer.wordpress.org/reference/functions/the_excerpt/Maybe it’s a better question for the WordPress support team?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 17, 2020 at 1:42 pm #1447750Jay
Sorry to have troubled you.
September 17, 2020 at 1:46 pm #1447752Leo
StaffCustomer SupportSorry I couldn’t be more helpful.
There are 3 ways to handle the excerpt using
the_excerpt()
function as far as I’m aware of:– The default word count excerpt method in the customizer which ignores all HTML.
– The excerpt metabox which accepts HTML:
https://www.wpbeginner.com/plugins/how-to-customize-wordpress-excerpts-no-coding-required/– And the more tag method.
Hope one of these would work for you.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.