Skip to content

Instantly share code, notes, and snippets.

@nickcernis
Created October 14, 2014 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickcernis/266a678addf3239ef38a to your computer and use it in GitHub Desktop.
Save nickcernis/266a678addf3239ef38a to your computer and use it in GitHub Desktop.
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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment