Tagged: H1, single post, title
When displaying a single post, I would like the post title to appear in the title_container div inside h1 tags. Right now it just says “Blog” (the name of the page that I have assigned the blog to in theme options) without h1 tags. I would also need to remove the single post title in the post-title div with h2 tags that is currently there.
I have looked at a few different solutions in searching the forums but I can’t find one that works for me.
Hi hmsvictory!
Add this to the bottom of your functions.php file.
add_filter( 'avf_title_args', 'enfold_customization_single_title', 0, 2 );
function enfold_customization_single_title( $args, $id ) {
if ( is_single() ) { $args['title'] = get_the_title($id); }
return $args;
}
And then comment out line 130 in /includes/loop-index.php.
echo $title;
Cheers!
Elliott
Elliott, thanks for the fast reply.
That does add the post title in the title_container div. I would like to wrap that title in h1 tags – is there a way to add that to the functions.php?
Changing the loop-index.php does remove the duplicate title in the post-title div on the single post pages. Unfortunately, it also removes the post titles on the regular blog index page :)
Something else I notice is the lack of consistency in the title_container div. Page titles outside the blog or store get h1 tags automatically.
But in the Store or Blog the content of the title_container div does not have h1 tags. This makes consistent styling & appearance more challenging.
Hey!
This will set it to an H1.
add_filter( 'avf_title_args', 'enfold_customization_single_title', 0, 2 );
function enfold_customization_single_title( $args, $id ) {
if ( is_single() ) { $args['title'] = get_the_title($id); $args['heading'] = 'h1'; }
return $args;
}
Best regards,
Elliott