Tagged: H1, single post, title
-
AuthorPosts
-
December 29, 2014 at 7:15 pm #372751
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.
December 29, 2014 at 8:02 pm #372773Hi 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!
ElliottDecember 29, 2014 at 8:48 pm #372798Elliott, 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 :)
December 29, 2014 at 9:12 pm #372807Something 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.
December 29, 2014 at 11:17 pm #372898Hey!
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 -
AuthorPosts
- You must be logged in to reply to this topic.
