After adding the function below to replace the default “Blog – Latest News” with the blog title, I noticed it doesn’t have H1 heading, where can I change the <strong class=”main-title entry-title”> to <h1 class=”main-title entry-title”>?
Thanks
add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
function fix_single_post_title($args,$id)
{
if ( $args['title'] == 'Blog - Latest News' )
{
$args['title'] = get_the_title($id);
$args['link'] = get_permalink($id);
}
return $args;
}
Hi ttem!
You can replace it with this:
add_filter('avf_title_args', 'fix_single_post_title', 10, 2);
function fix_single_post_title($args,$id)
{
if ( $args['title'] == 'Blog - Latest News' )
{
$args['title'] = get_the_title($id);
$args['link'] = get_permalink($id);
$args['heading'] = 'h1';
}
return $args;
}
Regards,
Ismael
Thank you Ismael that solved it perfectly! This now displays all the blog titles in the header just like on pages.
How can I remove the blog’s <h1 class=”post-title entry-title” itemprop=”headline”> within the bolg content area as this is now duplicate of the blog post’s header h1.
I tried hiding it via css but this also hid the blog title on the blog category archive pages.
Anyway to remove it from blog page php output loop?
Many thanks
Hi!
If you add #top.single-post to the selector you can hide the title only on single pages. Eg:
#top.single-post .entry-content-wrapper .post-title {
display: none;
}
Regards,
Devin
Thank you Devin that worked, I will have to brush up on my css a little :)