Make WordPress Core

Changeset 50802


Ignore:
Timestamp:
05/01/2021 06:12:22 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-content/themes/twentytwentyone
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwentyone/index.php

    r49826 r50802  
    1515 */
    1616
    17 get_header();
     17get_header(); ?>
     18
     19<?php if ( is_home() && ! is_front_page() && ! empty( single_post_title( '', false ) ) ) { ?>
     20    <header class="page-header alignwide">
     21        <h1 class="page-title"><?php single_post_title(); ?></h1>
     22    </header><!-- .page-header -->
     23<?php }
    1824
    1925if ( have_posts() ) {
  • trunk/src/wp-content/themes/twentytwentyone/template-parts/header/site-branding.php

    r49994 r50802  
    2828        <?php if ( is_front_page() && ! is_paged() ) : ?>
    2929            <h1 class="<?php echo esc_attr( $header_class ); ?>"><?php echo esc_html( $blog_info ); ?></h1>
    30         <?php elseif ( is_front_page() || is_home() ) : ?>
     30        <?php elseif ( is_front_page() && ! is_home() ) : ?>
    3131            <h1 class="<?php echo esc_attr( $header_class ); ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $blog_info ); ?></a></h1>
    3232        <?php else : ?>
Note: See TracChangeset for help on using the changeset viewer.