search.php example

<?php [get_header](http://codex.wordpress.org/Plugin_API/Action_Reference/get_header)(); ?>
     
        <div id="container">  
            <div id="content">

<?php if ( [have_posts](http://codex.wordpress.org/Function_Reference/have_posts)() ) : ?>
                 
                <h1 class="page-title"><?php [_e](http://codex.wordpress.org/Function_Reference/_e)( 'Search Results for: ', 'your-theme' ); ?><span><?php the_search_query(); ?></span></h1>
                 
<?php global $[WP_Query](http://codex.wordpress.org/Class_Reference/WP_Query); $total_pages = $[WP_Query](http://codex.wordpress.org/Class_Reference/WP_Query)->max_num_pages; if ( $total_pages > 1 ) { ?>
                <div id="nav-above" class="navigation">
                    <div class="nav-previous"><?php [next_posts_link](http://codex.wordpress.org/Function_Reference/next_posts_link)(__( '<span class="meta-nav">&laquo;</span> Older posts', 'your-theme' )) ?></div>
                    <div class="nav-next"><?php [previous_posts_link](http://codex.wordpress.org/Function_Reference/previous_posts_link)(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'your-theme' )) ?></div>
                </div><!-- #nav-above -->
<?php } ?>                            
 
<?php while ( [have_posts](http://codex.wordpress.org/Function_Reference/have_posts)() ) : [the_post](http://codex.wordpress.org/Plugin_API/Action_Reference/the_post)() ?>
 
                <div id="post-<?php [the_ID](http://codex.wordpress.org/Function_Reference/the_ID)(); ?>" <?php [post_class](http://codex.wordpress.org/Function_Reference/post_class)(); ?>>
                    <h2 class="entry-title"><a href="<?php [the_permalink](http://codex.wordpress.org/Plugin_API/Filter_Reference/the_permalink)(); ?>" title="<?php printf( __('Permalink to %s', 'your-theme'), [the_title_attribute](http://codex.wordpress.org/Function_Reference/the_title_attribute)('echo=0') ); ?>" rel="bookmark"><?php [the_title](http://codex.wordpress.org/Plugin_API/Filter_Reference/the_title)(); ?></a></h2>
 
<?php if ( $post->post_type == 'post' ) { ?>                                   
                    <div class="entry-meta">
                        <span class="meta-prep meta-prep-author"><?php [_e](http://codex.wordpress.org/Function_Reference/_e)('By ', 'your-theme'); ?></span>
                        <span class="author vcard"><a class="url fn n" href="<?php echo get_author_link( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'your-theme' ), $authordata->display_name ); ?>"><?php [the_author](http://codex.wordpress.org/Function_Reference/the_author)(); ?></a></span>
                        <span class="meta-sep"> | </span>
                        <span class="meta-prep meta-prep-entry-date"><?php [_e](http://codex.wordpress.org/Function_Reference/_e)('Published ', 'your-theme'); ?></span>
                        <span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-dTH:i:sO') ?>"><?php the_time( [get_option](http://codex.wordpress.org/Function_Reference/get_option)( 'date_format' ) ); ?></abbr></span>
                        <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class="meta-sep">|</span>ntttttt<span class="edit-link">", "</span>nttttt" ) ?>
                    </div><!-- .entry-meta -->
<?php } ?>
                     
                    <div class="entry-summary">   
<?php [the_excerpt](http://codex.wordpress.org/Function_Reference/the_excerpt)( __( 'Continue reading <span class="meta-nav">&raquo;</span>', 'your-theme' )  ); ?>
<?php [wp_link_pages](http://codex.wordpress.org/Function_Reference/wp_link_pages)('before=<div class="page-link">' . __( 'Pages:', 'your-theme' ) . '&after=</div>') ?>
                    </div><!-- .entry-summary -->
 
<?php if ( $post->post_type == 'post' ) { ?>                                   
                    <div class="entry-utility">
                        <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php [_e](http://codex.wordpress.org/Function_Reference/_e)( 'Posted in ', 'your-theme' ); ?></span><?php echo [get_the_category_list](http://codex.wordpress.org/Function_Reference/get_the_category_list)(', '); ?></span>
                        <span class="meta-sep"> | </span>
                        <?php [the_tags](http://codex.wordpress.org/Function_Reference/the_tags)( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'your-theme' ) . '</span>', ", ", "</span>ntttttt<span class="meta-sep">|</span>n" ) ?>
                        <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?></span>
                        <?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class="meta-sep">|</span>ntttttt<span class="edit-link">", "</span>ntttttn" ) ?>
                    </div><!-- #entry-utility -->   
<?php } ?>                    
                </div><!-- #post-<?php [the_ID](http://codex.wordpress.org/Function_Reference/the_ID)(); ?> -->
 
<?php endwhile; ?>
 
<?php global $[WP_Query](http://codex.wordpress.org/Class_Reference/WP_Query); $total_pages = $[WP_Query](http://codex.wordpress.org/Class_Reference/WP_Query)->max_num_pages; if ( $total_pages > 1 ) { ?>
                <div id="nav-below" class="navigation">
                    <div class="nav-previous"><?php [next_posts_link](http://codex.wordpress.org/Function_Reference/next_posts_link)(__( '<span class="meta-nav">&laquo;</span> Older posts', 'your-theme' )) ?></div>
                    <div class="nav-next"><?php [previous_posts_link](http://codex.wordpress.org/Function_Reference/previous_posts_link)(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'your-theme' )) ?></div>
                </div><!-- #nav-below -->
<?php } ?>            
 
<?php else : ?>
 
                <div id="post-0" class="post no-results not-found">
                    <h2 class="entry-title"><?php [_e](http://codex.wordpress.org/Function_Reference/_e)( 'Nothing Found', 'your-theme' ) ?></h2>
                    <div class="entry-content">
                        <p><?php [_e](http://codex.wordpress.org/Function_Reference/_e)( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'your-theme' ); ?></p>
    <?php [get_search_form](http://codex.wordpress.org/Function_Reference/get_search_form)(); ?>                       
                    </div><!-- .entry-content -->
                </div>
 
<?php endif; ?>
 
            </div><!-- #content -->     
        </div><!-- #container -->
         
<?php [get_sidebar](http://codex.wordpress.org/Function_Reference/get_sidebar)(); ?>   
<?php [get_footer](http://codex.wordpress.org/Plugin_API/Action_Reference/get_footer)(); ?>