[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwentyone/ -> single.php (source)

   1  <?php
   2  /**
   3   * The template for displaying all single posts
   4   *
   5   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
   6   *
   7   * @package WordPress
   8   * @subpackage Twenty_Twenty_One
   9   * @since Twenty Twenty-One 1.0
  10   */
  11  
  12  get_header();
  13  
  14  /* Start the Loop */
  15  while ( have_posts() ) :
  16      the_post();
  17  
  18      get_template_part( 'template-parts/content/content-single' );
  19  
  20      if ( is_attachment() ) {
  21          // Parent post navigation.
  22          the_post_navigation(
  23              array(
  24                  /* translators: %s: Parent post link. */
  25                  'prev_text' => sprintf( __( '<span class="meta-nav">Published in</span><span class="post-title">%s</span>', 'twentytwentyone' ), '%title' ),
  26              )
  27          );
  28      }
  29  
  30      // If comments are open or there is at least one comment, load up the comment template.
  31      if ( comments_open() || get_comments_number() ) {
  32          comments_template();
  33      }
  34  
  35      // Previous/next post navigation.
  36      $twentytwentyone_next = is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' );
  37      $twentytwentyone_prev = is_rtl() ? twenty_twenty_one_get_icon_svg( 'ui', 'arrow_right' ) : twenty_twenty_one_get_icon_svg( 'ui', 'arrow_left' );
  38  
  39      $twentytwentyone_next_label     = esc_html__( 'Next post', 'twentytwentyone' );
  40      $twentytwentyone_previous_label = esc_html__( 'Previous post', 'twentytwentyone' );
  41  
  42      the_post_navigation(
  43          array(
  44              'next_text' => '<p class="meta-nav">' . $twentytwentyone_next_label . $twentytwentyone_next . '</p><p class="post-title">%title</p>',
  45              'prev_text' => '<p class="meta-nav">' . $twentytwentyone_prev . $twentytwentyone_previous_label . '</p><p class="post-title">%title</p>',
  46          )
  47      );
  48  endwhile; // End of the loop.
  49  
  50  get_footer();


Generated: Fri Oct 22 01:00:02 2021 Cross-referenced by PHPXref 0.7.1