[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentyseventeen/ -> 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_Seventeen
  14   * @since Twenty Seventeen 1.0
  15   * @version 1.0
  16   */
  17  
  18  get_header(); ?>
  19  
  20  <div class="wrap">
  21      <?php if ( is_home() && ! is_front_page() ) : ?>
  22          <header class="page-header">
  23              <h1 class="page-title"><?php single_post_title(); ?></h1>
  24          </header>
  25      <?php else : ?>
  26      <header class="page-header">
  27          <h2 class="page-title"><?php _e( 'Posts', 'twentyseventeen' ); ?></h2>
  28      </header>
  29      <?php endif; ?>
  30  
  31      <div id="primary" class="content-area">
  32          <main id="main" class="site-main">
  33  
  34              <?php
  35              if ( have_posts() ) :
  36  
  37                  // Start the Loop.
  38                  while ( have_posts() ) :
  39                      the_post();
  40  
  41                      /*
  42                       * Include the Post-Format-specific template for the content.
  43                       * If you want to override this in a child theme, then include a file
  44                       * called content-___.php (where ___ is the Post Format name) and that
  45                       * will be used instead.
  46                       */
  47                      get_template_part( 'template-parts/post/content', get_post_format() );
  48  
  49                  endwhile;
  50  
  51                  the_posts_pagination(
  52                      array(
  53                          'prev_text'          => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
  54                          'next_text'          => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
  55                          'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
  56                      )
  57                  );
  58  
  59              else :
  60  
  61                  get_template_part( 'template-parts/post/content', 'none' );
  62  
  63              endif;
  64              ?>
  65  
  66          </main><!-- #main -->
  67      </div><!-- #primary -->
  68      <?php get_sidebar(); ?>
  69  </div><!-- .wrap -->
  70  
  71  <?php
  72  get_footer();


Generated: Sun Dec 22 01:00:02 2024 Cross-referenced by PHPXref 0.7.1