nickcernis
10/14/2014 - 11:46 AM

Swap title tags from h2 to h1 on the blog index page in Genesis HTML5 themes.

Swap title tags from h2 to h1 on the blog index page in Genesis HTML5 themes.

<?php

//* Template Name: Blog

remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action('genesis_entry_header', 'my_h1_blog_title');

function my_h1_blog_title () {
	$title = apply_filters( 'genesis_post_title_text', get_the_title() );

	if ( 0 === mb_strlen( $title ) )
		return;

	//* Link it, if necessary
	if ( ! is_singular() && apply_filters( 'genesis_link_post_title', true ) )
		$title = sprintf( '<a href="%s" rel="bookmark">%s</a>', get_permalink(), $title );

	$wrap = 'h1';

	//* Build the output
	$output = genesis_markup( array(
		'html5'   => "<{$wrap} %s>",
		'xhtml'   => sprintf( '<%s class="entry-title">%s</%s>', $wrap, $title, $wrap ),
		'context' => 'entry-title',
		'echo'    => false,
	) );

	$output .= genesis_html5() ? "{$title}</{$wrap}>" : '';

	echo apply_filters( 'genesis_post_title_output', "$output \n" );
}

genesis();