• Resolved Manu-PB

    (@manu-pb)


    Hi,

    I would like that the search exerpt will be built using the post excerpt – not the post content.

    I found that replacing :

    $content = apply_filters(‘relevanssi_pre_excerpt_content’, $post->post_content, $post, $query);

    by

    $content = apply_filters(‘relevanssi_pre_excerpt_content’, $post->post_excerpt, $post, $query);

    in function relevanssi_do_excerpt($t_post, $query) does the job.

    I just don’t know how to add this modification inside functions.php.

    Thanks for help.

    • This topic was modified 7 years ago by Manu-PB.
    • This topic was modified 7 years ago by Manu-PB.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    add_filter( 'relevanssi_pre_excerpt_content', 'rlv_use_excerpt', 1, 2 );
    function rlv_use_excerpt( $content, $post ) {
        return $post->post_excerpt;
    }

    That should do the trick. It fires on priority 1 on the hook and replaces the post content with the post excerpt.

    Thread Starter Manu-PB

    (@manu-pb)

    Works like charm.
    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘building the search excerpt from post excerpt’ is closed to new replies.