WordPress search results with images and MORE tag

Default WordPress search results do not have pictures and Continue reading prompt, so it is not obvious for many users they have to click on the post title to see the whole article.

To correct that, open search.php of your theme. Find the following part:

		<?php if ( have_posts() ) : ?>
			<?php while ( have_posts() ) : the_post(); ?>
				<?php get_template_part( 'content', 'excerpt' ); ?>
			<?php endwhile; ?>
		<?php endif; ?>

and make it look like this it to this:

		<?php if ( have_posts() ) : ?>
			<?php while ( have_posts() ) : the_post(); ?>
				<?php get_template_part( 'content', get_post_format() ); ?>
			<?php endwhile; ?>
		<?php endif; ?>

Save the file. No search results page should look like the home page of your blog. This change is extremely recommended to be used together with the autosearch 404.php page.

Leave a Comment