Looking to discover how to alter my content.php code to add the thumbnail image of the specific posts to my search results located here for example:


I would like a thumbnail of the featured post’s image listed along with the smaller blurb of the post in the search results.

    <?php get_template_part( 'content', get_post_format() ); ?>

by somehow changing content.php I can have it include a small thumbnail along with each search result. My theme already has thumb support I just need help implementing it.

Any help on doing this would be appreciated.

PS. I do have a child theme installed

2 Answers 2


Use the_post_thumbnail. For example:

<?php if ( has_post_thumbnail()) : ?>
   <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
   <?php the_post_thumbnail(); ?>
<?php endif; ?>

Modifying content.php is a possible way to go.

Start by finding the right place to insert lines similar to this:

if (is_search()) {

The function the_post_thumbnail() will output the image selected as featured image upon editing the post. is_search() limits this output to when showing search results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.