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

git-svn-id: http://svn.automattic.com/wordpress/trunk@18291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-06-12 17:43:03 +00:00
parent ed5785c9ef
commit ed78ffaf14
5 changed files with 85 additions and 5 deletions

View File

@ -17,6 +17,8 @@ get_header(); ?>
<section id="primary"> <section id="primary">
<div id="content" role="main"> <div id="content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"> <h1 class="page-title">
<?php if ( is_day() ) : ?> <?php if ( is_day() ) : ?>
@ -48,6 +50,21 @@ get_header(); ?>
<?php twentyeleven_content_nav( 'nav-below' ); ?> <?php twentyeleven_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
</div><!-- #content --> </div><!-- #content -->
</section><!-- #primary --> </section><!-- #primary -->

View File

@ -12,6 +12,8 @@ get_header(); ?>
<section id="primary"> <section id="primary">
<div id="content" role="main"> <div id="content" role="main">
<?php if ( have_posts() ) : ?>
<?php <?php
/* Queue the first post, that way we know /* Queue the first post, that way we know
* what author we're dealing with (if that is the case). * what author we're dealing with (if that is the case).
@ -19,8 +21,7 @@ get_header(); ?>
* We reset this later so we can run the loop * We reset this later so we can run the loop
* properly with a call to rewind_posts(). * properly with a call to rewind_posts().
*/ */
if ( have_posts() ) the_post();
the_post();
?> ?>
<header class="page-header"> <header class="page-header">
@ -66,6 +67,21 @@ get_header(); ?>
<?php twentyeleven_content_nav( 'nav-below' ); ?> <?php twentyeleven_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
</div><!-- #content --> </div><!-- #content -->
</section><!-- #primary --> </section><!-- #primary -->

View File

@ -12,6 +12,8 @@ get_header(); ?>
<section id="primary"> <section id="primary">
<div id="content" role="main"> <div id="content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"><?php <h1 class="page-title"><?php
printf( __( 'Category Archives: %s', 'twentyeleven' ), '<span>' . single_cat_title( '', false ) . '</span>' ); printf( __( 'Category Archives: %s', 'twentyeleven' ), '<span>' . single_cat_title( '', false ) . '</span>' );
@ -41,6 +43,21 @@ get_header(); ?>
<?php twentyeleven_content_nav( 'nav-below' ); ?> <?php twentyeleven_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
</div><!-- #content --> </div><!-- #content -->
</section><!-- #primary --> </section><!-- #primary -->

View File

@ -17,6 +17,8 @@ get_header(); ?>
<div id="primary"> <div id="primary">
<div id="content" role="main"> <div id="content" role="main">
<?php if ( have_posts() ) : ?>
<?php twentyeleven_content_nav( 'nav-above' ); ?> <?php twentyeleven_content_nav( 'nav-above' ); ?>
<?php /* Start the Loop */ ?> <?php /* Start the Loop */ ?>
@ -28,6 +30,21 @@ get_header(); ?>
<?php twentyeleven_content_nav( 'nav-below' ); ?> <?php twentyeleven_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
</div><!-- #content --> </div><!-- #content -->
</div><!-- #primary --> </div><!-- #primary -->

View File

@ -12,7 +12,7 @@ get_header(); ?>
<section id="primary"> <section id="primary">
<div id="content" role="main"> <div id="content" role="main">
<?php the_post(); ?> <?php if ( have_posts() ) : ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"><?php <h1 class="page-title"><?php
@ -26,8 +26,6 @@ get_header(); ?>
?> ?>
</header> </header>
<?php rewind_posts(); ?>
<?php twentyeleven_content_nav( 'nav-above' ); ?> <?php twentyeleven_content_nav( 'nav-above' ); ?>
<?php /* Start the Loop */ ?> <?php /* Start the Loop */ ?>
@ -45,6 +43,21 @@ get_header(); ?>
<?php twentyeleven_content_nav( 'nav-below' ); ?> <?php twentyeleven_content_nav( 'nav-below' ); ?>
<?php else : ?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
<?php endif; ?>
</div><!-- #content --> </div><!-- #content -->
</section><!-- #primary --> </section><!-- #primary -->