I have the blank-theme wordpress theme, and would like in the search results also appear as a thumbnail. Is it possible?
search.php
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<h2>Resultados de Búsqueda:</h2>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
<?php while (have_posts()) : the_post(); ?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href='<?php echo get_permalink($post->ID)?>'><?php the_title(); ?></a></h2>
<?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
<div class="entry">
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; ?>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
<?php else : ?>
<h2>Ningún tema encontrado...</h2>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
By default
search.php
just output the search results title and short description (depends on theme).To show thumbnail as well just call the wordpress function
the_post_thumbnail()
within the loop.Try this:
Full Code:
get_the_post_thumbnail
http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
Maybe this can help:
Add thumbnail to search results ONLY if the thumbnail is available?