-
AuthorPosts
-
June 7, 2017 at 6:39 pm #805227
Hi there awesome support team,
I’m looking to do just what the below thread covered, but the link with the info is not longer available. Any chance it could be re added?
https://kriesi.at/support/topic/adding-featured-images-to-the-search-result/
June 7, 2017 at 8:13 pm #805253well look to find the loop-search.php in enfold/includes
make a copy of it and upload an edited version to your child-theme subfolder includes. (commonly it is: enfold-child/includes )how to edit :
look to line (version Enfold 4.0.7) : 31echo "<span class='search-result-counter {$counterclass}'>{$post_loop_count}</span>";
and replace it with:
$searchthumb = get_the_post_thumbnail( $the_id, 'large' ); echo "<span class='search-result-counter {$counterclass}'>{$searchthumb}</span>";
and add this to quick css:
.search-result-counter { padding: 0; } .search-result-counter img { width: 100%; height: 100%; border-radius: 100px; }
- This reply was modified 7 years, 6 months ago by Guenni007.
June 7, 2017 at 8:27 pm #805258if you like to have both a counter number and than a featured image above the title same line
big advantage – if there is no featured image – counter is still there – and only image is missingfind:
echo "<span class='search-result-counter {$counterclass}'>{$post_loop_count}</span>";
replace 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>";
you see the line stays in the code but two lines are added before
then you only have to style the featured image size f.e.:
.search-result-image img { width: 300px; }
- This reply was modified 7 years, 6 months ago by Guenni007.
June 12, 2017 at 6:50 am #806731June 12, 2017 at 11:01 am #806811That’s great everyone, thank you so much!
June 13, 2017 at 4:22 am #807193Hi,
Glad we could help and thanks @guenni007 for helping out :-)
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardJune 16, 2017 at 12:15 pm #808939That’s everything.
Thank you all!!
June 17, 2017 at 7:48 am #809212 -
AuthorPosts
- The topic ‘Show featured images in search results page’ is closed to new replies.