Created
October 14, 2014 11:46
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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