[Resolved] Replace Excerpt with Subtitle

Home Forums Support [Resolved] Replace Excerpt with Subtitle

Home Forums Support Replace Excerpt with Subtitle

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1865799
    Serban

    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.

    #1865904
    Elvin
    Staff
    Customer Support

    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' );

    #1865968
    Serban

    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.

    #1866127
    David
    Staff
    Customer 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);
    #1867698
    Serban

    Yes. That worked. Thank you!

    #1868205
    David
    Staff
    Customer Support

    Glad to be of help

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.