[Support request] Site title is showing as , how to change it to H1?

Home Forums Support [Support request] Site title is showing as , how to change it to H1?

Home Forums Support Site title is showing as , how to change it to H1?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2373609
    Rekamedia

    Hi,

    Why my website site title is showing the site title in <p> tag?
    Normally site title will shown as H1. This is currently is shown in my website:

    <p class="main-title" itemprop="headline"><a href="https://google.com/" rel="home">Site Title</a></p>

    #2373632
    David
    Staff
    Customer Support

    Hi there,

    by default the Theme outputs the site title as follows:

    1. Homepage set to Display latests posts only uses: <h1>.
    As this page does not have a H1 Content title by default.

    2. All other pages it displays the site title as a <p>
    As other pages by default have a H1 Content title

    So do you want every page to have the site title as a H1 ? As that may lead to multiple H1s on pages and posts.

    #2373634
    Rekamedia

    Hi,

    Let me try create a heading in the page with H1 tag.

    (Update): I created a heading H1 with the main keyword. So now the site title is still showing in <p>, and the homepage has one H1 with the main keyword. Is this normal?

    Usually on other theme, the site title is always in H1.

    #2373652
    David
    Staff
    Customer Support

    As i said above the only time we output the Site Title as a H1 is on a Homepage that is set to display the latest posts.
    As this is the only page that does not have a H1 Content Title.

    On every other Page, Post, Archive the Content Title gets output as a H1, so you do not want the Site Title to be a H1 there.

    #2373659
    Rekamedia

    But, my homepage is not showing latest post, this is my use case, it’s a sales page. How to change this?
    I want the site title to be always in H1, so I can use other heading to other keywords.

    #2373692
    Rekamedia

    Any code that I can use to fix this?

    #2373700
    David
    Staff
    Customer Support

    You can add this PHP Snippet and it will change the Site Title to H1 on every page:

    
    add_filter( 'generate_site_title_output', function( $output ) {
        return sprintf(
            '<h1 class="main-title"%3$s>
                <a href="%2$s" rel="home">
                    %2$s
                </a>
            </h1>',
            esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
            get_bloginfo( 'name' ),
            'microdata' === generate_get_schema_type() ? ' itemprop="headline"' : ''
        );
    });
    #2374002
    Rekamedia

    It says synxtax error?

    Update: It’s ok, missing a ;

    #2374219
    David
    Staff
    Customer Support

    Sorry about that, correct the code above.

    Glad to hear you got it working

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.