Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #220132

    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;
    }
    #220234

    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

    #223712

    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

    #224717

    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

    #225094

    Thank you Devin that worked, I will have to brush up on my css a little :)

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Replaced the default “Blog – Latest News” title needs H1 heading’ is closed to new replies.