How can I just show the post content in a search result? Currently, the search results displays the post title, author and date above the page content.

Here is how it looks now: http://sikkervaccination.dk/?s=thailand

  • 1
    What do you want to happen if the search returns more than one result?
    – s_ha_dum
    Jan 13, 2013 at 21:56
  • Impossible to tell when we don't know A) your theme template code and B) if there's plugins influencing the search results are involved. Please update your question.
    – kaiser
    Jan 14, 2013 at 1:43

3 Answers 3


Some themes like Twenty Fourteen include a template tag included in the content.php file for entry meta which includes the author and date:



The content.php file also includes the_title() tag so you need to remove that if you don't want the entry titles displaying on your search result pages.

The search.php file includes this tag which includes the content.php

get_template_part( 'content', get_post_format() );

To display content only on the search results pages, you would need to create your own custom search.php file.

To do this using the Twenty Fourteen theme for example, copy over the search.php file to a child theme and modify the code there.

You could then copy over the content.php file from your parent theme to your child theme, rename it to something like customsearch.php and change the template template in your child themes search.php file to:

get_template_part( 'customsearch' );

Then you simply modify your customsearch.php file in your child theme and your code is saved from any parent theme updates.

Source & Examples


You can usually modify the display of your search results by editing a loop in search.php file in your theme folder. It depends on your theme, though. Some themes may have this code located in another file, like loop.php, loop-search.php or loop-posts.php to give you some examples, but you should start by looking at the search.php file.

  • I have installed the plugin "Relevanssi" and limited the indexed pages by excluding all the unwanted pages by page-id. Should the search return more than one result the content would be stacked on top of each other in order of relevance (determined by the plugin parameters). I could not find any relevant code in any of those files though. Here is a url by the way: sikkervaccination.dk/?s=thailand
    – Michael
    Jan 13, 2013 at 22:27
  • What kind of code should i look for in those files? I might be looking for the wrong thing?
    – Michael
    Jan 13, 2013 at 22:37
  • 1
    This page may give you an idea of where the search page is located. Different themes handle it differently.
    – Dan
    Jan 14, 2013 at 0:00

In your post loop in search.php, add this code

the_content(); // use this line or use below one
echo get_the_content($post->ID);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.