Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
1  
What do you want to happen if the search returns more than one result? –  s_ha_dum Jan 13 '13 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 '13 at 1:43
add comment

2 Answers

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.

share|improve this answer
    
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 '13 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 '13 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 '13 at 0:00
add comment

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);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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