How can I show Featured image assigned to the project in the search results?

Hello :slight_smile:

How can I show the Featured image assigned to the project in the search results?

By default, the results are presented only by Project name and Excerpt:

http://demo.athemes.com/sydney/?s=eta

I would be very grateful for your help

Hello there,

The default theme’s code doesn’t support to display featured image in the search result page. To do so, you’ll need to edit the content-search.php file. To retain the code changes when updating the theme, you have to use a child theme.

Use our pre-made one if you haven’t yet been running any. In the child theme folder, you’ll need a copy of the content-search.php file from parent theme. Edit it. Right after this line:

   <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

Add this code block:

    <?php if ( has_post_thumbnail() ) : ?>
    	<div class="entry-thumb">
    		<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('sydney-large-thumb'); ?></a>
    	</div>
    <?php endif; ?>

The complete code will look like this.

Regards,
Kharis

1 Like

Thank You :slight_smile: great and quick and very helpful :slight_smile:

maybe I will only change:

<?php the_post_thumbnail('sydney-large-thumb'); ?>

for

<?php the_post_thumbnail('sydney-small-thumb'); ?>

:slight_smile: again Thank you

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis