[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwenty/template-parts/ -> content-cover.php (source)

   1  <?php
   2  /**
   3   * Displays the content when the cover template is used.
   4   *
   5   * @package WordPress
   6   * @subpackage Twenty_Twenty
   7   * @since Twenty Twenty 1.0
   8   */
   9  
  10  ?>
  11  
  12  <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
  13      <?php
  14      // On the cover page template, output the cover header.
  15      $cover_header_style   = '';
  16      $cover_header_classes = '';
  17  
  18      $color_overlay_style   = '';
  19      $color_overlay_classes = '';
  20  
  21      $image_url = ! post_password_required() ? get_the_post_thumbnail_url( get_the_ID(), 'twentytwenty-fullscreen' ) : '';
  22  
  23      if ( $image_url ) {
  24          $cover_header_style   = ' style="background-image: url( ' . esc_url( $image_url ) . ' );"';
  25          $cover_header_classes = ' bg-image';
  26      }
  27  
  28      // Get the color used for the color overlay.
  29      $color_overlay_color = get_theme_mod( 'cover_template_overlay_background_color' );
  30      if ( $color_overlay_color ) {
  31          $color_overlay_style = ' style="color: ' . esc_attr( $color_overlay_color ) . ';"';
  32      } else {
  33          $color_overlay_style = '';
  34      }
  35  
  36      // Get the fixed background attachment option.
  37      if ( get_theme_mod( 'cover_template_fixed_background', true ) ) {
  38          $cover_header_classes .= ' bg-attachment-fixed';
  39      }
  40  
  41      // Get the opacity of the color overlay.
  42      $color_overlay_opacity  = get_theme_mod( 'cover_template_overlay_opacity' );
  43      $color_overlay_opacity  = ( false === $color_overlay_opacity ) ? 80 : $color_overlay_opacity;
  44      $color_overlay_classes .= ' opacity-' . $color_overlay_opacity;
  45      ?>
  46  
  47      <div class="cover-header <?php echo $cover_header_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>"<?php echo $cover_header_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) ?>>
  48          <div class="cover-header-inner-wrapper screen-height">
  49              <div class="cover-header-inner">
  50                  <div class="cover-color-overlay color-accent<?php echo esc_attr( $color_overlay_classes ); ?>"<?php echo $color_overlay_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We need to double check this, but for now, we want to pass PHPCS ;) ?>></div>
  51  
  52                      <header class="entry-header has-text-align-center">
  53                          <div class="entry-header-inner section-inner medium">
  54  
  55                              <?php
  56  
  57                              /**
  58                               * Allow child themes and plugins to filter the display of the categories in the article header.
  59                               *
  60                               * @since Twenty Twenty 1.0
  61                               *
  62                               * @param bool Whether to show the categories in article header. Default true.
  63                               */
  64                              $show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true );
  65  
  66                              if ( true === $show_categories && has_category() ) {
  67                                  ?>
  68  
  69                                  <div class="entry-categories">
  70                                      <span class="screen-reader-text"><?php _e( 'Categories', 'twentytwenty' ); ?></span>
  71                                      <div class="entry-categories-inner">
  72                                          <?php the_category( ' ' ); ?>
  73                                      </div><!-- .entry-categories-inner -->
  74                                  </div><!-- .entry-categories -->
  75  
  76                                  <?php
  77                              }
  78  
  79                              the_title( '<h1 class="entry-title">', '</h1>' );
  80  
  81                              if ( is_page() ) {
  82                                  ?>
  83  
  84                                  <div class="to-the-content-wrapper">
  85  
  86                                      <a href="#post-inner" class="to-the-content fill-children-current-color">
  87                                          <?php twentytwenty_the_theme_svg( 'arrow-down' ); ?>
  88                                          <div class="screen-reader-text"><?php _e( 'Scroll Down', 'twentytwenty' ); ?></div>
  89                                      </a><!-- .to-the-content -->
  90  
  91                                  </div><!-- .to-the-content-wrapper -->
  92  
  93                                  <?php
  94                              } else {
  95  
  96                                  $intro_text_width = '';
  97  
  98                                  if ( is_singular() ) {
  99                                      $intro_text_width = ' small';
 100                                  } else {
 101                                      $intro_text_width = ' thin';
 102                                  }
 103  
 104                                  if ( has_excerpt() ) {
 105                                      ?>
 106  
 107                                      <div class="intro-text section-inner max-percentage<?php echo esc_attr( $intro_text_width ); ?>">
 108                                          <?php the_excerpt(); ?>
 109                                      </div>
 110  
 111                                      <?php
 112                                  }
 113  
 114                                  twentytwenty_the_post_meta( get_the_ID(), 'single-top' );
 115  
 116                              }
 117                              ?>
 118  
 119                          </div><!-- .entry-header-inner -->
 120                      </header><!-- .entry-header -->
 121  
 122              </div><!-- .cover-header-inner -->
 123          </div><!-- .cover-header-inner-wrapper -->
 124      </div><!-- .cover-header -->
 125  
 126      <div class="post-inner" id="post-inner">
 127  
 128          <div class="entry-content">
 129  
 130          <?php
 131          the_content();
 132          ?>
 133  
 134          </div><!-- .entry-content -->
 135          <?php
 136          wp_link_pages(
 137              array(
 138                  'before'      => '<nav class="post-nav-links bg-light-background" aria-label="' . esc_attr__( 'Page', 'twentytwenty' ) . '"><span class="label">' . __( 'Pages:', 'twentytwenty' ) . '</span>',
 139                  'after'       => '</nav>',
 140                  'link_before' => '<span class="page-number">',
 141                  'link_after'  => '</span>',
 142              )
 143          );
 144  
 145          edit_post_link();
 146          // Single bottom post meta.
 147          twentytwenty_the_post_meta( get_the_ID(), 'single-bottom' );
 148  
 149          if ( post_type_supports( get_post_type( get_the_ID() ), 'author' ) && is_single() ) {
 150  
 151              get_template_part( 'template-parts/entry-author-bio' );
 152  
 153          }
 154          ?>
 155  
 156      </div><!-- .post-inner -->
 157  
 158      <?php
 159  
 160      if ( is_single() ) {
 161  
 162          get_template_part( 'template-parts/navigation' );
 163      }
 164  
 165      /*
 166       * Output comments wrapper if it's a post, or if comments are open,
 167       * or if there's a comment number – and check for password.
 168       */
 169      if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) {
 170          ?>
 171  
 172          <div class="comments-wrapper section-inner">
 173  
 174              <?php comments_template(); ?>
 175  
 176          </div><!-- .comments-wrapper -->
 177  
 178          <?php
 179      }
 180      ?>
 181  
 182  </article><!-- .post -->


Generated: Sat Nov 23 01:00:02 2024 Cross-referenced by PHPXref 0.7.1