Archived topic
Do not preview a piece of text
7 replies · Started by Daniele on August 7, 2021
Hi, I have a series of articles that all have the same five-line header, so in the blog previews I wish these didn't appear as they are all the same. Is there a way to prevent part of an article text from being taken as a preview for the blog?
Thank you!
Daniele
Hi there,
the easiest fix would be to give those posts a Custom Excerpt, in the Post editor.
Then you can set some other text for each of those posts.
Thanks David, but in this way the "Read All" button no longer appears .. Isn't there an instruction to place in the html of the text, to say to ignore a part of the text for the preview?
Daniele
Hi Daniele,
This snippet can activate read more when using custom excerpt:
https://docs.generatepress.com/article/activating-read-custom-excerpt/
Adding PHP: https://docs.generatepress.com/article/adding-php/
Thanks Ying, you are very nice and kind, I have to put it in the function file, right?
Daniele
If you're using a Child Theme, then yes it can go in the child themes functions.php
More info here on adding PHP:
Thanks David!
You're welcome