Make WordPress Core


Ignore:
Timestamp:
06/12/2011 05:43:03 PM (13 years ago)
Author:
ryan
Message:

Add no posts found message to templates. Props sorich87. fixes #17735

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/tag.php

    r18058 r18291  
    1313            <div id="content" role="main">
    1414
    15                 <?php the_post(); ?>
     15            <?php if ( have_posts() ) : ?>
    1616
    1717                <header class="page-header">
     
    2626                    ?>
    2727                </header>
    28 
    29                 <?php rewind_posts(); ?>
    3028
    3129                <?php twentyeleven_content_nav( 'nav-above' ); ?>
     
    4644                <?php twentyeleven_content_nav( 'nav-below' ); ?>
    4745
     46            <?php else : ?>
     47
     48                <article id="post-0" class="post no-results not-found">
     49                    <header class="entry-header">
     50                        <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
     51                    </header><!-- .entry-header -->
     52
     53                    <div class="entry-content">
     54                        <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
     55                        <?php get_search_form(); ?>
     56                    </div><!-- .entry-content -->
     57                </article><!-- #post-0 -->
     58
     59            <?php endif; ?>
     60
    4861            </div><!-- #content -->
    4962        </section><!-- #primary -->
Note: See TracChangeset for help on using the changeset viewer.