WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/17/2017 10:23:25 AM (2 years ago)
Author:
swissspidy
Message:

Twenty Seventeen: Correct heading hierarchy for posts on the front page.

When the posts page is on the front page or within a front page section, the heading hierarchy for the individual post titles needs to be adjusted accordingly.

Props joedolson, celloexpressions, davidakennedy.
Fixes #40264.

Merges [40458] to the 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-content/themes/twentyseventeen/template-parts/post/content-excerpt.php

    r38833 r40459  
    3131        <?php endif; ?>
    3232
    33         <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
     33        <?php if ( is_front_page() && ! is_home() ) {
     34
     35            // The excerpt is being displayed within a front page section, so it's a lower hierarchy than h2.
     36            the_title( sprintf( '<h3 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' );
     37        } else {
     38            the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
     39        } ?>
    3440    </header><!-- .entry-header -->
    3541
Note: See TracChangeset for help on using the changeset viewer.