Support » Plugin: Relevanssi - A Better Search » [Plugin: Relevanssi – A Better Search] Show featured image in search results

  • I checked ‘index attachment’ option, but pictures attached to the posts aren’t showing next to the excerpt on Search Results page.

    Here’s the code I’m using:

    <div class="post-entry">
                        <?php if( ( $video_thumbnail = get_video_thumbnail() ) != null ) { echo "<img width='270' class='alignleft-video' src='" . $video_thumbnail . "' />"; } ?>
    					<?php if ( has_post_thumbnail()) : ?>
                            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
    							<?php the_post_thumbnail('archive-image', array('class' => 'alignleft')); ?>
                        <?php endif; ?>
                        <?php the_excerpt(); ?>
                        <?php wp_link_pages(array('before' => '<div class="pagination">' . __('Pages:', 'responsive'), 'after' => '</div>')); ?>
                    </div><!-- end of .post-entry -->

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


    I don’t know why the image is not showing. Does it work without Relevanssi? Whether or not Relevanssi indexes attachments has nothing to do with this. The post thumbnail code should show up with that code.

    Yes, it works without Relevanssi.

    Plugin Author Mikko Saari


    Well, I don’t know why it doesn’t work with Relevanssi, there’s no reason why Relevanssi should mess with that.

    I’m using Relevanssi Premium, if that makes a difference.

    Plugin Author Mikko Saari


    No, it doesn’t.

    What does has_post_thumbnail() return? If you replace

    <?php if ( has_post_thumbnail()) : ?>


    <?php var_dump(has_post_thumbnail()); if ( has_post_thumbnail()) : ?>

    what do you get?

    Anyway, I tried thumbnails on my test blog, and there’s no problem displaying them. As far as I can tell, there should be no reason why the thumbnails should not work with Relevanssi.

    If you can give me admin access to your site, I could take a look at this, but otherwise I won’t be able to help more. My email is mikko at

    bool(true) and bool(false)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Relevanssi – A Better Search] Show featured image in search results’ is closed to new replies.