Make WordPress Core

Changeset 20006


Ignore:
Timestamp:
02/28/2012 03:48:34 AM (15 years ago)
Author:
lancewillett
Message:

Twenty Twelve: better "no posts found" message and action for index view. If a logged-in user can edit posts, show an appropriate message. Otherwise, show the normal "no posts found" message. See #19978.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/index.php

    r19915 r20006  
    2929
    3030                        <article id="post-0" class="post no-results not-found">
     31
     32                        <?php if ( current_user_can( 'edit_posts' ) ) :
     33                                // Show a different message to a logged-in user who can add posts.
     34                        ?>
    3135                                <header class="entry-header">
    32                                         <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
     36                                        <h1 class="entry-title"><?php _e( 'No posts to display', 'twentytwelve' ); ?></h1>
     37                                </header><!-- .entry-header -->
     38
     39                                <div class="entry-content">
     40                                        <p><?php printf( __( 'Ready to publish your first post? <a href="%s">Get started here</a>.', 'twentytwelve' ), admin_url( 'post-new.php' ) ); ?></p>
     41                                </div><!-- .entry-content -->
     42
     43                        <?php else :
     44                                // Show the default message to everyone else.
     45                        ?>
     46                                <header class="entry-header">
     47                                        <h1 class="entry-title"><?php _e( 'Nothing found', 'twentytwelve' ); ?></h1>
    3348                                </header><!-- .entry-header -->
    3449
    … …  
    3752                                        <?php get_search_form(); ?>
    3853                                </div><!-- .entry-content -->
     54                        <?php endif; // end current_user_can() check ?>
     55
    3956                        </article><!-- #post-0 -->
    4057
    41                 <?php endif; ?>
     58                <?php endif; // end have_posts() check ?>
    4259
    4360                </div><!-- #content -->
Note: See TracChangeset for help on using the changeset viewer.