[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwelve/ -> index.php (source)

   1  <?php
   2  /**
   3   * The main template file.
   4   *
   5   * This is the most generic template file in a WordPress theme
   6   * and one of the two required files for a theme (the other being style.css).
   7   * It is used to display a page when nothing more specific matches a query.
   8   * E.g., it puts together the home page when no home.php file exists.
   9   * Learn more: http://codex.wordpress.org/Template_Hierarchy
  10   *
  11   * @package WordPress
  12   * @subpackage Twenty_Twelve
  13   */
  14  
  15  get_header(); ?>
  16  
  17      <div id="primary">
  18          <div id="content" role="main">
  19          <?php if ( have_posts() ) : ?>
  20  
  21              <?php /* Start the Loop */ ?>
  22              <?php while ( have_posts() ) : the_post(); ?>
  23                  <?php get_template_part( 'content', get_post_format() ); ?>
  24              <?php endwhile; ?>
  25  
  26              <?php twentytwelve_content_nav( 'nav-below' ); ?>
  27  
  28          <?php else : ?>
  29  
  30              <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              ?>
  35                  <header class="entry-header">
  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>
  48                  </header><!-- .entry-header -->
  49  
  50                  <div class="entry-content">
  51                      <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
  52                      <?php get_search_form(); ?>
  53                  </div><!-- .entry-content -->
  54              <?php endif; // end current_user_can() check ?>
  55  
  56              </article><!-- #post-0 -->
  57  
  58          <?php endif; // end have_posts() check ?>
  59  
  60          </div><!-- #content -->
  61      </div><!-- #primary -->
  62  
  63  <?php get_sidebar(); ?>
  64  <?php get_footer(); ?>


Generated: Tue Mar 20 03:55:56 2012 Hosted by follow the white rabbit.