mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-29 04:28:07 +01:00
43b86a246c
Welcome to the bundled themes family! Theme development to this point has taken place on GitHub. See: https://github.com/WordPress/twentytwenty/. Props anlino, ianbelanger, audrasjb, nielslange, fabiankaegy, mukesh27, poena, joyously, emiluzelac, williampatton, dingo-d, dkarfa, acosmin, rabmalin, kafleg, jeffpaul, hareesh-pillai, burhandodhy, afercia, juanfra, soean, presskopp, justinahinon, jrf, netweb, garyj, pento, flixos90, vbaimas, zebulan, byalextran, mor10, kjellr, allancole, tdh, karmatosed, mapk, matt, andrewtaylor-1, ismailelkorchi, garrett-eclipse, gsayed786, dianeco, celloexpressions, aristath, nadir, cbravobernal, intimez, hometowntrailers, collet, littlebigthing, tobifjellner, kevinkovadia, jarretc. See #48110. Built from https://develop.svn.wordpress.org/trunk@46271 git-svn-id: http://core.svn.wordpress.org/trunk@46083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
180 lines
5.3 KiB
PHP
180 lines
5.3 KiB
PHP
<?php
|
||
/**
|
||
* Displays the content when the cover template is used.
|
||
*
|
||
* @package WordPress
|
||
* @subpackage Twenty_Twenty
|
||
* @since 1.0.0
|
||
*/
|
||
|
||
?>
|
||
|
||
<article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
|
||
<?php
|
||
// On the cover page template, output the cover header.
|
||
$cover_header_style = '';
|
||
$cover_header_classes = '';
|
||
|
||
$color_overlay_style = '';
|
||
$color_overlay_classes = '';
|
||
|
||
$image_url = ! post_password_required() ? get_the_post_thumbnail_url( get_the_ID(), 'twentytwenty-fullscreen' ) : '';
|
||
|
||
if ( $image_url ) {
|
||
$cover_header_style = ' style="background-image: url( ' . esc_url( $image_url ) . ' );"';
|
||
$cover_header_classes = ' bg-image';
|
||
}
|
||
|
||
// Get the color used for the color overlay.
|
||
$color_overlay_color = get_theme_mod( 'cover_template_overlay_background_color' );
|
||
if ( $color_overlay_color ) {
|
||
$color_overlay_style = ' style="color: ' . esc_attr( $color_overlay_color ) . ';"';
|
||
} else {
|
||
$color_overlay_style = '';
|
||
}
|
||
|
||
// Get the fixed background attachment option.
|
||
if ( get_theme_mod( 'cover_template_fixed_background', true ) ) {
|
||
$cover_header_classes .= ' bg-attachment-fixed';
|
||
}
|
||
|
||
// Get the opacity of the color overlay.
|
||
$color_overlay_opacity = get_theme_mod( 'cover_template_overlay_opacity' );
|
||
$color_overlay_opacity = ( false === $color_overlay_opacity ) ? 80 : $color_overlay_opacity;
|
||
$color_overlay_classes .= ' opacity-' . $color_overlay_opacity;
|
||
|
||
// Get the blend mode of the color overlay (default = multiply).
|
||
$color_overlay_opacity = get_theme_mod( 'cover_template_overlay_blend_mode', 'multiply' );
|
||
$color_overlay_classes .= ' blend-mode-' . $color_overlay_opacity;
|
||
?>
|
||
|
||
<div class="cover-header screen-height screen-width<?php echo esc_attr( $cover_header_classes ); ?>"<?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 ;) ?>>
|
||
<div class="cover-header-inner-wrapper">
|
||
<div class="cover-header-inner">
|
||
<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>
|
||
|
||
<header class="entry-header has-text-align-center">
|
||
<div class="entry-header-inner section-inner medium">
|
||
|
||
<?php
|
||
|
||
// Allow child themes and plugins to filter the display of the categories in the entry header.
|
||
$show_categories = apply_filters( 'twentytwenty_show_categories_in_entry_header', true );
|
||
|
||
if ( true === $show_categories && has_category() ) {
|
||
?>
|
||
|
||
<div class="entry-categories">
|
||
<span class="screen-reader-text"><?php esc_html_e( 'Categories', 'twentytwenty' ); ?></span>
|
||
<div class="entry-categories-inner">
|
||
<?php the_category( ' ' ); ?>
|
||
</div><!-- .entry-categories-inner -->
|
||
</div><!-- .entry-categories -->
|
||
|
||
<?php
|
||
}
|
||
|
||
the_title( '<h1 class="entry-title">', '</h1>' );
|
||
|
||
if ( is_page() ) {
|
||
?>
|
||
|
||
<div class="to-the-content-wrapper">
|
||
|
||
<a href="#post-inner" class="to-the-content fill-children-current-color">
|
||
<?php twentytwenty_the_theme_svg( 'arrow-down' ); ?>
|
||
<div class="screen-reader-text"><?php _e( 'Scroll Down', 'twentytwenty' ); // phpcs:ignore WordPress.Security.EscapeOutput.UnsafePrintingFunction -- core trusts translations ?></div>
|
||
</a><!-- .to-the-content -->
|
||
|
||
</div><!-- .to-the-content-wrapper -->
|
||
|
||
<?php
|
||
} else {
|
||
|
||
$intro_text_width = '';
|
||
|
||
if ( is_singular() ) {
|
||
$intro_text_width = ' small';
|
||
} else {
|
||
$intro_text_width = ' thin';
|
||
}
|
||
|
||
if ( has_excerpt() ) {
|
||
?>
|
||
|
||
<div class="intro-text section-inner max-percentage<?php echo esc_attr( $intro_text_width ); ?>">
|
||
<?php the_excerpt(); ?>
|
||
</div>
|
||
|
||
<?php
|
||
}
|
||
|
||
twentytwenty_the_post_meta( get_the_ID(), 'single-top' );
|
||
|
||
}
|
||
?>
|
||
|
||
</div><!-- .entry-header-inner -->
|
||
</header><!-- .entry-header -->
|
||
|
||
</div><!-- .cover-header-inner -->
|
||
</div><!-- .cover-header-inner-wrapper -->
|
||
</div><!-- .cover-header -->
|
||
|
||
<div class="post-inner section-inner thin" id="post-inner">
|
||
|
||
<div class="entry-content">
|
||
|
||
<?php
|
||
the_content();
|
||
?>
|
||
|
||
</div><!-- .entry-content -->
|
||
<?php
|
||
|
||
wp_link_pages(
|
||
array(
|
||
'before' => '<nav class="post-nav-links bg-light-background" aria-label="' . esc_attr__( 'Page', 'twentytwenty' ) . '"><span class="label">' . __( 'Pages:', 'twentytwenty' ) . '</span>',
|
||
'after' => '</nav>',
|
||
)
|
||
);
|
||
|
||
edit_post_link();
|
||
// Single bottom post meta.
|
||
twentytwenty_the_post_meta( get_the_ID(), 'single-bottom' );
|
||
|
||
if ( is_single() ) {
|
||
|
||
get_template_part( 'template-parts/entry-author-bio' );
|
||
|
||
}
|
||
?>
|
||
|
||
</div><!-- .post-inner -->
|
||
|
||
<?php
|
||
|
||
if ( is_single() ) {
|
||
|
||
get_template_part( 'template-parts/navigation' );
|
||
}
|
||
|
||
/**
|
||
* Output comments wrapper if it's a post, or if comments are open,
|
||
* or if there's a comment number – and check for password.
|
||
* */
|
||
if ( ( 'post' === $post->post_type || comments_open() || get_comments_number() ) && ! post_password_required() ) {
|
||
?>
|
||
|
||
<div class="comments-wrapper section-inner">
|
||
|
||
<?php comments_template(); ?>
|
||
|
||
</div><!-- .comments-wrapper -->
|
||
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
</article><!-- .post -->
|