Search results page post templates? [wordpress]

i was wondering if you need or can make post templates for search results page only on wordpress. I’m developing my own child theme using underscores.me framework on localhost and have come across an issue which has lead me to ask this question. T

he issue itself is that the post content for post’s (for both standard and custom post types) gets changed on the search results page to the url of the post permalink –

Read More

e.g. if i search for post titled movie3 it will return a result on the search results page, but the post movie3 will have the post body removed, including the excerpt and read more etc and instead have the title and date followed by localhost/?movies=movie3 instead of the excerpt or post body (I’m using optional excerpts), followed by tags etc.

This is the first time I’m developing with wordpress and was also wondering if a plug in like relevanssi would alleviate my issues, especially since I’ve read that wordpress search is supposed to be terrible?

Related posts

Leave a Reply

1 comment

  1. If you are building your own theme I would not suggest using a plugin for this. The underscores theme should have an search.php page included in the wp-content/themes/yourtheme directory. This is the default template for displaying search results.

    The default search.php template for underscore should have “the loop” included:

    <?php while ( have_posts() ) : the_post(); ?>

    You can call WordPress functions such as the_excerpt(); inside “the loop” to get the excerpt of the returned post. See http://codex.wordpress.org/Function_Reference/the_excerpt for more information on this.