New heading structure - redux of #651. Provides proper semantic structure for titles throughout theme:

In header.php: Site title set to H1 on front page, div on other pages
In functions.php: Widget title set to H2 for semantic hierarchy
In content-search.php and content.php: Heading set to H2 as page title is "Search" or "Archive title" etc.
This commit is contained in:
Morten Rand-Hendriksen 2015-06-28 12:06:02 -07:00
parent 5bb0534358
commit dc6d3fa08c
4 changed files with 9 additions and 5 deletions

View File

@ -102,8 +102,8 @@ function _s_widgets_init() {
'description' => '', 'description' => '',
'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>', 'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">', 'before_title' => '<h2 class="widget-title">',
'after_title' => '</h1>', 'after_title' => '</h2>',
) ); ) );
} }
add_action( 'widgets_init', '_s_widgets_init' ); add_action( 'widgets_init', '_s_widgets_init' );

View File

@ -24,7 +24,11 @@
<header id="masthead" class="site-header" role="banner"> <header id="masthead" class="site-header" role="banner">
<div class="site-branding"> <div class="site-branding">
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> <?php if ( is_front_page() && is_home() ) : ?>
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<div class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></div>
<?php endif; ?>
<p class="site-description"><?php bloginfo( 'description' ); ?></p> <p class="site-description"><?php bloginfo( 'description' ); ?></p>
</div><!-- .site-branding --> </div><!-- .site-branding -->

View File

@ -11,7 +11,7 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header"> <header class="entry-header">
<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?> <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php if ( 'post' == get_post_type() ) : ?> <?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta"> <div class="entry-meta">

View File

@ -9,7 +9,7 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header"> <header class="entry-header">
<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?> <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php if ( 'post' == get_post_type() ) : ?> <?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta"> <div class="entry-meta">