WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Showing posts in search results (3 posts)

  1. jennifer2010
    Member
    Posted 2 years ago #

    Hi,

    I am trying to get my search results page for my theme to display the full posts instead of just titles and tags.

    Here is my current theme's setup:

    <?php
    /**
     * @package WordPress
     * @subpackage Pretty_Theme
     */
    
    get_header(); ?>
    
    	<div id="content" class="narrowcolumn resultspage">
    
    	<?php if (have_posts()) : ?>
    
    		<h2 class="pagetitle specialtitle">Search Results</h2>
    		<?php if (is_search()) { ?>
    			<small class="queryBlog">You have searched this blog for <strong>'<?php the_search_query(); ?>'</strong>.</small>
    			<?php } ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div <?php post_class() ?>>
    				<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    				<small><?php the_time('l, F jS, Y') ?></small>
    				<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?><?php edit_post_link('Edit', ' | ', ''); ?></p>
    
    			</div>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="pagetitle searchtitle">No Search Results Found</h2>
    			<small class="queryBlog">Try a different search.</small>
    		<div class="searchboxbody">
    		<?php get_search_form(); ?>
    		</div>
    	<?php endif; ?>
    
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    Thank you

  2. curtismchale
    Member
    Posted 2 years ago #

    Just after the line that reads <small><?php the_time('l, F jS, Y'); ?></small> add <?php the_content(); ?>

  3. jennifer2010
    Member
    Posted 2 years ago #

    Worked like a charm - thanks so much!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.