Archived topic
Excerpts overridden in archives
5 replies · Started by Paul on October 8, 2018
I was delighted to discover GeneratePress, which seems so flexible for such a lean theme, and have happily purchased the pro verion. However, there is one problem that I hope you might be able to help me with, regarding archive layouts.
I want the archive to show the excerpt for the post, which it happily does UNLESS it finds a <--more--!> command in its html. If it does, then it includes everything above it, including its text style and image if there is one, which can duplicate the featured image.
You can see an example of this on my Space news archive, where the first two posts show incorrectly as they have the <--more--!> command, but the third shows the excerpt because it doesn't!
Is there a bit of CSS which would tell it to ignore the <--more--!> and only to use the excerpt? I don't want to have to go through hundreds of old posts to remove this bit of html from every one, and I think they were useful for rss readers.
Incidentally, I have used an alternative, Atomic Blocks' post grid plugin, for the Home Page https://www.skymania.com/wp/ but I would probably prefer to use the built-in archive display if this problem can be solved.
Thank you.
Hi there,
GP doesn't do anything special for the excerpt feature - it's all controlled by WordPress':
https://developer.wordpress.org/reference/functions/the_excerpt/
I'm not aware of any CSS or PHP that will remove/overwrite the more tag for you unfortunately.
You can try checking with WordPress support but I doubt there is a way as the more tag is supposed to overwrite the excerpt function:
https://wordpress.org/support/
Let me know if this helps :)
Thank you. I don't plan to remove the <!--more--> tag from hundreds of posts, though I suspect that something like Better Search Replace could do it.
I take your point about this being a Wordpress issue. It would be interesting therefore to know how Atomic Blocks manage to get around it with their AB post grid block for Gutenberg, as demonstrated on my front page, as indeed does your very own Tom's WP Show Posts plugin.
Perhaps the solution will need to be a workaround that I saw suggested in another thread, where I create separate pages for categories, using one of these plugins, and then do a 301 redirect from the Wordpress category archive address to the new page.
Thanks anyway.
Paul
Actually I think this filter should work:
https://generatepress.com/forums/topic/blog-excerpt-length-not-working/#post-122509
Let me know :)
Thank you. That seems to have worked, using the code snippets trick of Tom's. Interestingly, for very old posts which have no excerpt, it does still take a few lines of text, but without the styling up of the intro or repeating the image, so that's perfectly fine too!
Cheers,
Paul
No problem :)