Archived topic
excerpt for pages on Search page
7 replies · Started by Heiki on October 19, 2021
Is it possible to show or set up a nice excerpt for pages as well.
If user performs search on my site, then all my pages have their full content shown. Is there a way to turn it off or have a nice well written short excerpt for every page. I tried every setting in CUSTOMIZE but I didn't find it.
PS! my ARTICLES (posts) have nice excerpt.
My site is in JPN, but if you copy & paste this URL it will show my search results of pages.
https://iiwakenashi.com/?s=%E3%83%AC%E3%83%83%E3%82%B0%E3%83%97%E3%83%AC%E3%82%B9
Thank you
Hi there,
You can enable excerpts on page by adding this PHP snippet.
add_post_type_support( 'page', 'excerpt' );
Activating this snippet on your site will enable manual excerpt field for static pages as shown here - https://share.getcloudapp.com/5zu95ZL2
Thank you for such i speedy reply.
May I ask where should I put that code?
Unfortunately I am not a coder. And if i add it to my
PHP code, will it be gone when I update my theme?
Sorry for so many questions. Thank you
Hi there,
this article explains how to add PHP:
https://docs.generatepress.com/article/adding-php/
TLDR: If you have a Child Theme installed then it can be added to the child themes functions.php, if you're not using a child theme then install the Code Snippets plugin ( link i doc ) and create a new snippet for that code. Both of these options will keep the code when the theme is updated.
Thank you! It worked very well. Just to be sure, i had to activate that Snippet SITE-wide, right?
Thank you for good support.
i had to activate that Snippet SITE-wide
Thats correct.
Glad to be of help
OK, thank you guys. You are always super helpful! Happy to be here
Glad we could be of help!