• Using Relevanssi and loving it, will soon be picking up Premium for the PDF searches.

    Using Elementor Pro / Archive Posts element for search results.

    Question: Relevanssi finds the short description for Woocommerce products and is the perfect excerpt in search, but the excerpt for pages is using garbled text.

    I would like to have it use the SEOPress meta description field as a source for Page and Post excerpts. I would be open to using another WordPress built-in field as well, but can’t find much on how to do this. Most of what I’ve found is in PHP which I’m not too familiar with.

    Are there any articles on this that can point me in the right direction?

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

    (@msaari)

    One way to do this is to disable custom excerpts in Relevanssi and set up Elementor to display the description meta field (_seopress_titles_desc) instead of the post excerpt. It would help if you asked Elementor support how to do that; I don’t know how you do it in Elementor.

    Another option is to make Relevanssi use only the SEOPress description as source material for excerpts. This might do it:

    add_filter( 'relevanssi_pre_excerpt_content', function( $content, $post ) {
      $meta_desc = get_post_meta( $post->ID, '_seopress_titles_desc', true );
      if ( $meta_desc ) {
        $content = $meta_desc;
      }
      return $content;
    }, 10, 2 );

    Hi there!

    I allow myself to add this link containing the list of all available custom fields (post meta) that can be used:

    https://www.seopress.org/support/guides/list-of-all-post-metas-generated-by-seopress/

    🙂

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

The topic ‘Add Excerpt Source Field’ is closed to new replies.