July 7, 2013 at 5:28 am #11482
I have tried to add a call for the thumbnail to the content.php in the
if ( is_search() )section but the thumbnail still isn’t showing in the search results.
if ( is_search() ) : // Only display Excerpts for Search ?> <div class="entry-summary"> <?php the_post_thumbnail('thumbnail'); ?> <?php the_excerpt(); ?> </div><!-- .entry-summary -->
I also tried to remove this section but that doesn’t work either.
How do I get the thumbnail to show in the search results?July 7, 2013 at 11:59 am #11490
@Trishah: Can you send me your site URL? I need to check in your site and see which theme are you using it.July 8, 2013 at 12:08 am #11500
ugh. Sorry, I should have told you that. I am using a child theme for CatchBox. My development install can be found here: http://trishah.com/clients/sofia/site/July 8, 2013 at 1:47 pm #11532
@Trishah: You code looks like just replace that
<?php the_post_thumbnail('thumbnail'); ?>with
<?php if( has_post_thumbnail() ):?> <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'catchbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"> <?php the_post_thumbnail('featured-slider'); ?> </a> <?php endif; ?>
then you need to check in those post has featured image or not. If those post don’t have featured image then it will not display the image. See this for featured image http://en.support.wordpress.com/featured-images/#setting-a-featured-imageJuly 9, 2013 at 3:11 am #11575
Yes, that is the answer. Thank you very much Sakin!
BTW, I simply love the CatchBox theme. Once I understood it’s structure it makes it relatively simple to create responsive websites. 😀July 9, 2013 at 10:44 am #11588
- The topic ‘add thumbnail to serach results’ is closed to new replies.