[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentysixteen/ -> 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   *
  10   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  11   *
  12   * @package WordPress
  13   * @subpackage Twenty_Sixteen
  14   * @since Twenty Sixteen 1.0
  15   */
  16  
  17  get_header(); ?>
  18  
  19      <div id="primary" class="content-area">
  20          <main id="main" class="site-main">
  21  
  22          <?php if ( have_posts() ) : ?>
  23  
  24              <?php if ( is_home() && ! is_front_page() ) : ?>
  25                  <header>
  26                      <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
  27                  </header>
  28              <?php endif; ?>
  29  
  30              <?php
  31              // Start the loop.
  32              while ( have_posts() ) :
  33                  the_post();
  34  
  35                  /*
  36                   * Include the Post-Format-specific template for the content.
  37                   * If you want to override this in a child theme, then include a file
  38                   * called content-___.php (where ___ is the Post Format name) and that
  39                   * will be used instead.
  40                   */
  41                  get_template_part( 'template-parts/content', get_post_format() );
  42  
  43                  // End the loop.
  44              endwhile;
  45  
  46              // Previous/next page navigation.
  47              the_posts_pagination(
  48                  array(
  49                      'prev_text'          => __( 'Previous page', 'twentysixteen' ),
  50                      'next_text'          => __( 'Next page', 'twentysixteen' ),
  51                      'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
  52                  )
  53              );
  54  
  55              // If no content, include the "No posts found" template.
  56          else :
  57              get_template_part( 'template-parts/content', 'none' );
  58  
  59          endif;
  60          ?>
  61  
  62          </main><!-- .site-main -->
  63      </div><!-- .content-area -->
  64  
  65  <?php get_sidebar(); ?>
  66  <?php get_footer(); ?>


Generated: Sun Nov 10 01:00:03 2024 Cross-referenced by PHPXref 0.7.1