WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
Custom Field Excerpt/Content not showing (2 posts)

  1. roothost
    Member
    Posted 2 years ago #

    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() ?>
        <h2><?=the_title()?></h2>
        <p><? the_time('F j, Y') ?> at <? the_time(); ?> by <? the_author_link(); ?></p>
        <p><?php relevanssi_the_excerpt(); ?></p>
       <? endwhile; ?>
    <? endif; ?>

    http://wordpress.org/extend/plugins/relevanssi/

  2. Mikko Saari
    Member
    Plugin Author

    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags