Support » Plugin: Relevanssi - A Better Search » [Plugin: Relevanssi – A Better Search] Custom Field Excerpt/Content not showing

  • Having spent the last 2 days on this, and having tried every single plugin available I am well and truly stumped!!

    I have a site that relies very heavily on custom fields (using the advanced custom field) plugin. Now I need to have a search function on the site that, when a term is entered, outputs all results from anywhere on the site (static pages, posts, custom fields etc).

    Currently, my output code is this, which returns the title and date/time fine, but just gives me “…” instead of any actual content?

    <? if(have_posts()): ?>
      <? while(have_posts()): ?>
        <? the_post() ?>
        <p><? the_time('F j, Y') ?> at <? the_time(); ?> by <? the_author_link(); ?></p>
        <p><?php relevanssi_the_excerpt(); ?></p>
       <? endwhile; ?>
    <? endif; ?>

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


    You need to do some custom programming to get custom fields showing in the excerpt. Use the relevanssi_excerpt_content filter to add the custom field content to the post content (just concatenate it to the end). The filter filters the post content, and has two parameters, the $post object (so you can get the $post->ID) and the query.

    Also, just use the_excerpt() instead of relevanssi_the_excerpt(), that should not be necessary.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] Custom Field Excerpt/Content not showing’ is closed to new replies.