Archived topic
Custom excerpt in home and archives
10 replies · Started by mariosem on May 28, 2021
Hello,
maybe I'm not so smart but I just cannot figure out how to get the custom excerpt in home page and in the archive pages. I just get the post opening paragraph before the "read more" block.
Please see my test site.
Thanks,
Mario
Hi there,
you are using the More Tag in your posts - which wins over the custom excerpt.
If you want GP to ignore the More Tag - then you can add this PHP Snippet:
add_filter( 'generate_more_tag', '__return_empty_string' );
How to add PHP Snippets:
https://docs.generatepress.com/article/adding-php/
Hi David,
thanks for your answer. I think it would be useful not to have to install more plugins. If the theme, in the future, could support this feature, it would be great.
Its actually WP logic in play here. The pecking order for displaying Excerpts is as follows:
1. More Tag
2. Manual Excerpt
3. Auto Excerpt
Generally its best to avoid having both 1 and 2 on a post. We added that PHP Filter to overcome that problem as many users may have imported a lot of posts with More Tags that were no longer required.
But we'll take note for the future - thanks for the feedback.
Thanks,
I've asked because someone else modified that pecking order, making the "More" tag and the manual excerpt coexistent, as you can see from my production site.
Best,
Mario
I've installed PHP Snippet plugin, created and activated the snippet, but nothing happened. Any suggestions?
Did you try this plugin:
Yes, it's the one I'm using.
Is "Excerpt" set as your Content Type in "Customize > Layout > Blog"?
No, it wasn't. Now it works, thanks!
You're welcome! :)