Twenty Twenty-One: Display page title as the H1 heading when a static page is selected as the "Posts page".

This ensures that the heading represents the content of the page. Previously, the site title was displayed instead.

Props sabernhardt, justinahinon, rianrietveld, mukesh27, francina, audrasjb, Boniu91.
Fixes #52938.
Built from https://develop.svn.wordpress.org/trunk@50802


git-svn-id: http://core.svn.wordpress.org/trunk@50411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-05-01 18:14:05 +00:00
parent 6c9dfaede8
commit 85d526c5d0
3 changed files with 9 additions and 3 deletions

View File

@ -14,7 +14,13 @@
* @since Twenty Twenty-One 1.0
*/
get_header();
get_header(); ?>
<?php if ( is_home() && ! is_front_page() && ! empty( single_post_title( '', false ) ) ) { ?>
<header class="page-header alignwide">
<h1 class="page-title"><?php single_post_title(); ?></h1>
</header><!-- .page-header -->
<?php }
if ( have_posts() ) {

View File

@ -27,7 +27,7 @@ $header_class = $show_title ? 'site-title' : 'screen-reader-text';
<?php if ( $blog_info ) : ?>
<?php if ( is_front_page() && ! is_paged() ) : ?>
<h1 class="<?php echo esc_attr( $header_class ); ?>"><?php echo esc_html( $blog_info ); ?></h1>
<?php elseif ( is_front_page() || is_home() ) : ?>
<?php elseif ( is_front_page() && ! is_home() ) : ?>
<h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></h1>
<?php else : ?>
<p class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></p>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-50801';
$wp_version = '5.8-alpha-50802';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.