Archived topic
Replace Excerpt with Subtitle
5 replies · Started by Serban on July 22, 2021
Hi, I have added a subtitle as instructed here. (It works, not problems).
Question: How do I replace my excerpt in Blog Layouts with the Subtitle I just created?
Thanks for your help.
Hi Serban,
I'm not sure I'm seeing the subtitle element on your site. Perhaps I'm looking on the wrong page.
Can you link us to a sample page w/ the subtitle showing up?
If the actual subtitle is showing on the page and you simply want to remove the excerpt, you can add this PHP snippet.
add_filter( 'generate_show_excerpt', '__return_false' );
Hello Elvin,
See the Subtitle activated here: https://prnt.sc/1eb24ez
Your suggested PHP Snippet will activate my blog page to show Full content for the first (featured) post! I just want to replace the excerpt with the Subtitles as shown in the (private section) image.
Any other suggestions?
Thanks for the support.
Hi there,
try this snippet instead:
add_filter( 'get_the_excerpt', function() {
$subtitle = get_the_subtitle( get_the_ID(), '', '', false );
if ( $subtitle ) {
return $subtitle;
}
return wp_trim_excerpt();
}, 10, 2);
Yes. That worked. Thank you!
Glad to be of help