WordPress.org

Ready to get started?Download WordPress

Forums

Relevanssi - A Better Search
Show featured image in search results (7 posts)

  1. phantasmix
    Member
    Posted 1 year ago #

    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')); ?>
                            </a>
                        <?php endif; ?>
                        <?php the_excerpt(); ?>
                        <?php wp_link_pages(array('before' => '<div class="pagination">' . __('Pages:', 'responsive'), 'after' => '</div>')); ?>
                    </div><!-- end of .post-entry -->

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

  2. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. phantasmix
    Member
    Posted 1 year ago #

    Yes, it works without Relevanssi.

  4. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

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

  5. phantasmix
    Member
    Posted 1 year ago #

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

  6. Mikko Saari
    Member
    Plugin Author

    Posted 1 year ago #

    No, it doesn't.

    What does has_post_thumbnail() return? If you replace

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

    with

    <?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 relevanssi.com.

  7. phantasmix
    Member
    Posted 1 year ago #

    bool(true) and bool(false)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic