Post #805258 shows the code (below), to add to the loop-search.php file, which adds an image to the product search results page. Although it works perfect, you only get a text link to the product.
How can you add the same link to image as well?
Thanks.
REPLACE:
echo “<span class=’search-result-counter {$counterclass}’>{$post_loop_count}</span>”;
WITH:
$searchimage = get_the_post_thumbnail( $the_id, ‘large’ );
echo “<span class=’search-result-image’>{$searchimage}</span>”;
echo “<span class=’search-result-counter {$counterclass}’>{$post_loop_count}</span>”;
QUICK CSS:
.search-result-image img {
width: 300px;
}
Hey dwags52,
Please try editing the loop-search.php file, and replacing line 31:
echo "<span class='search-result-counter {$counterclass}'>{$post_loop_count}</span>";
with:
$searchimage = get_the_post_thumbnail( $the_id, 'large' );
echo "<span class='search-result-image'><a title='".the_title_attribute('echo=0')."' href='".get_permalink()."' $markup>{$searchimage}</a></span>";
echo "<span class='search-result-counter {$counterclass}'>{$post_loop_count}</span>";
and use the same Quick CSS:
.search-result-image img {
width: 300px;
}
Best regards,
Mike
Hi Mike.
Thanks so much for the help.
Worked perfect!
Dwight
Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon