Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ajay

    (@ajay)

    Unfortunately, I have not yet coded a way to put in the thumbnails. I’m working on a version that makes this a better and cleaner process.

    Right now the only way is to edit better-search.php and add the code in around line 165:

    https://plugins.trac.www.ads-software.com/browser/better-search/tags/1.3.1/better-search.php

    Something like this should work

    <?php echo get_the_post_thumbnail( $search->ID, $size, $attr ); ?>

    Would like to follow up on this: I tried simply pasting above code into better-search.php using Genesis Dynamik theme, so that the code looks like this:

    $output .= '<h2><a href="'.get_permalink($search->ID).'" rel="bookmark">'.$post_title.'</a></h2>';
    				$output .= '<p>';
    				$output .= get_bsearch_score($search,$score,$topscore);
    				$before = __('&nbsp;&nbsp;&nbsp;&nbsp; Posted on: ', BSEARCH_LOCAL_NAME);
    				$output .= get_bsearch_date($search,$before);
    				$output .= '</p>';
    				<?php echo get_the_post_thumbnail( $search->ID, $size, $attr ); ?>
    				$output .= '<p>';
    				$output .= get_bsearch_excerpt($search->ID,$bsearch_settings['excerpt_length']);	// This displays the post excerpt / creates it. Replace with $output .= $content; to use content instead of excerpt
    				$output .= '</p>';
    			} //end of foreach loop

    and unfortunately I get an error:

    Parse error: syntax error, unexpected ‘<‘ in /Users/Paul/Documents/Websites/balanga.dev/wp-content/plugins/better-search/better-search.php on line 165

    I’m not a coder, but I would love to get your plugin showing small thumbnails with the results. Did I adjust the code wrongly? Could I Beta test the plugin version that you are developing that achieves this?

    Cheers

    Plugin Author Ajay

    (@ajay)

    Instead of the code you used, try:

    $output .= '<span class="bsearch_thumb">'.get_the_post_thumbnail( $search->ID, $size, $attr ).'</span>';

    just tried the code…almost working: i get full sized image rather than thumbnail displaying…

    any way to reduce image size so it displays alongside text?

    Thanks!

    Plugin Author Ajay

    (@ajay)

    Try the below code. This should pull just the thumbnail version of the image

    $output .= '<span class="bsearch_thumb">'.get_the_post_thumbnail( $search->ID, 'thumbnail' ).'</span>';

    Cheers Ajay – that worked!
    Paul

    Plugin Author Ajay

    (@ajay)

    Glad to know this Paul ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display thumbnails on search results page’ is closed to new replies.