If you want to change h1
html tag to a h2
because you already used the h1
tag in your template, or because you need to add some classes to the entry title, use this code to filter out the output of the entry title. This snippet goes into functions.php
if you want to use this code into a single.php
, page.php
or any other page template file, just remove the conditional check from the snippet below.
//* Filter Genesis H1 Post Titles
add_filter( 'genesis_post_title_output', 'bn_post_title_output', 15 );
function bn_post_title_output( $title ) {
if ( is_singular() ) {
$title = sprintf( '<h2 class="entry-title">%s</h2>', apply_filters( 'genesis_post_title_text', get_the_title() ) );
return $title;
}
}
Leave a Reply