• Piero

    (@pierosparviero)


    In the search result page the whole content of posts is displayed. Instead of it, I would like to display only the excerpt and date. Is it possible?

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes. That’s up to your theme. Replacing the_content() in the theme search results template with the_excerpt() is the standard way to fix this, if your theme doesn’t have a setting you can adjust. If the search results template doesn’t exist or does something more complicated, theme support is the best place to ask about this.

    Thread Starter Piero

    (@pierosparviero)

    Thank you.

    How can I contact theme support team?

    Plugin Author Mikko Saari

    (@msaari)

    I don’t even know which theme you are using, so I have no idea. If it’s a premium theme, the theme developers should have a customer support channel. If it’s a free theme, then look at the support forums hosted here at WordPress.org – each theme in the repository has a support forum.

    Thread Starter Piero

    (@pierosparviero)

    Sorry: I’m using Twenty TwentyFive.

    I can extrapolate from examples, that I should simply write [Twenty twentifive] in the object case of the help request form.

    Again: thank you

    Plugin Author Mikko Saari

    (@msaari)

    Ah, in that case I can help you out. Add this snippet to your site:

    add_filter( 'wp_trim_words', function( $text, $num_words, $more, $original_text ) {
    global $post;
    if ( isset( $post->relevance_score ) ) {
    return $post->post_excerpt;
    }
    return $text;
    }, 10, 4 );

    That will get you excerpts from Relevanssi instead of the full post content.

    Thread Starter Piero

    (@pierosparviero)

    A big thanks

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.