[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
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"> 71 <?php 72 /* translators: Hidden accessibility text. */ 73 _e( 'Categories', 'twentytwenty' ); 74 ?> 75 </span> 76 <div class="entry-categories-inner"> 77 <?php the_category( ' ' ); ?> 78 </div><!-- .entry-categories-inner --> 79 </div><!-- .entry-categories --> 80 81 <?php 82 } 83 84 the_title( '<h1 class="entry-title">', '</h1>' ); 85 86 if ( is_page() ) { 87 ?> 88 89 <div class="to-the-content-wrapper"> 90 91 <a href="#post-inner" class="to-the-content fill-children-current-color"> 92 <?php twentytwenty_the_theme_svg( 'arrow-down' ); ?> 93 <div class="screen-reader-text"> 94 <?php 95 /* translators: Hidden accessibility text. */ 96 _e( 'Scroll Down', 'twentytwenty' ); 97 ?> 98 </div> 99 </a><!-- .to-the-content --> 100 101 </div><!-- .to-the-content-wrapper --> 102 103 <?php 104 } else { 105 106 $intro_text_width = ''; 107 108 if ( is_singular() ) { 109 $intro_text_width = ' small'; 110 } else { 111 $intro_text_width = ' thin'; 112 } 113 114 if ( has_excerpt() ) { 115 ?> 116 117 <div class="intro-text section-inner max-percentage<?php echo esc_attr( $intro_text_width ); ?>"> 118 <?php the_excerpt(); ?> 119 </div> 120 121 <?php 122 } 123 124 twentytwenty_the_post_meta( get_the_ID(), 'single-top' ); 125 126 } 127 ?> 128 129 </div><!-- .entry-header-inner --> 130 </header><!-- .entry-header --> 131 132 </div><!-- .cover-header-inner --> 133 </div><!-- .cover-header-inner-wrapper --> 134 </div><!-- .cover-header --> 135 136 <div class="post-inner" id="post-inner"> 137 138 <div class="entry-content"> 139 140 <?php 141 the_content(); 142 ?> 143 144 </div><!-- .entry-content --> 145 <?php 146 wp_link_pages( 147 array( 148 'before' => '<nav class="post-nav-links bg-light-background" aria-label="' . esc_attr__( 'Page', 'twentytwenty' ) . '"><span class="label">' . __( 'Pages:', 'twentytwenty' ) . '</span>', 149 'after' => '</nav>', 150 'link_before' => '<span class="page-number">', 151 'link_after' => '</span>', 152 ) 153 ); 154 155 edit_post_link(); 156 // Single bottom post meta. 157 twentytwenty_the_post_meta( get_the_ID(), 'single-bottom' ); 158 159 if ( post_type_supports( get_post_type( get_the_ID() ), 'author' ) && is_single() ) { 160 161 get_template_part( 'template-parts/entry-author-bio' ); 162 163 } 164 ?> 165 166 </div><!-- .post-inner --> 167 168 <?php 169 170 if ( is_single() ) { 171 172 get_template_part( 'template-parts/navigation' ); 173 } 174 175 /* 176 * Output comments wrapper if it's a post, or if comments are open, 177 * or if there's a comment number – and check for password. 178 */ 179 if ( ( is_single() || is_page() ) && ( comments_open() || get_comments_number() ) && ! post_password_required() ) { 180 ?> 181 182 <div class="comments-wrapper section-inner"> 183 184 <?php comments_template(); ?> 185 186 </div><!-- .comments-wrapper --> 187 188 <?php 189 } 190 ?> 191 192 </article><!-- .post -->
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Wed Dec 18 08:20:01 2024 | Cross-referenced by PHPXref |