[Resolved] Wrong title showing as h1 tag

Home Forums Support [Resolved] Wrong title showing as h1 tag

Home Forums Support Wrong title showing as h1 tag

Viewing 15 posts - 16 through 30 (of 47 total)
  • Author
    Posts
  • #1297233
    Joe

    Followed the video instructions to activate the Disable Elements and Elements. Gone into pages but the field with the options are not in here as in video.

    #1297285
    Joe

    Strange why I’m not seeing this. Just went through looking for this again.

    #1297511
    Leo
    Staff
    Customer Support

    It should definitely be there.

    Are you using the Gutenberg editor?

    If so it would be on the right hand side.

    Let me know 🙂

    #1297615
    Joe

    Changed over to Gutenberg and found it on the right hand side as you mention. Ticked the Content Title box which has stripped out the h1 tags. Is this what you are looking for.

    #1297879
    Joe

    Doing this has not put site title in h1 tags. All it has done is removed the tags. Surely this is no answer.

    #1297891
    David
    Staff
    Customer Support

    If i understand correctly in place of the Content Title ie. Home you want it to display the Site Title.
    If that is the case then remove the Content Title using the Disable Elements

    Then edit your Page in Elementor and add in your own H1 Heading and write in your Site title.

    #1297895
    Joe

    As stated, I want the theme to show my site title in h1 tags on the home page.

    #1297937
    Joe

    As I was requested to do above, I have already removed Content Title using the Disable Elements. But was awaiting the next stage. So does Generate Press theme not automaticaly have h1 tags?

    #1297943
    David
    Staff
    Customer Support

    The Site Title will switch to H1 on the front page IF it is set to display the Latest Posts.
    For a static home page you will need to add this PHP Snippet:

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

    Using static home page. Could you please show me where abouts to add the code you provided?

    #1297956
    David
    Staff
    Customer Support

    oop sorry – for sure – this article explains:

    https://docs.generatepress.com/article/adding-php/

    TLDR: If your using a Child Theme it goes in your funtions.php. If not use the Code Snippets plugin: https://en-gb.wordpress.org/plugins/code-snippets/ to add this code.

    #1297964
    Joe

    I an using a Child Theme so will add it to the funtions.php. Can you point to where in the code to add the extra part?

    <?php
    /**
    * GeneratePress child theme functions and definitions.
    *
    * Add your custom PHP in this file.
    * Only edit this file if you have direct access to it on your server (to fix errors if they happen).
    */

    function generatepress_child_enqueue_scripts() {
    if ( is_rtl() ) {
    wp_enqueue_style( ‘generatepress-rtl’, trailingslashit( get_template_directory_uri() ) . ‘rtl.css’ );
    }
    }
    add_action( ‘wp_enqueue_scripts’, ‘generatepress_child_enqueue_scripts’, 100 );

    #1298212
    Joe

    I am really surprised that this theme does not have this feature already built in. As far a I was aware using the H1 tag for a post or page’s title was the best option regarding the SEO of a site. So the question is. Is this a problem with my site only or are all other sites using Generate Press built the same way and have to add extra code in order to have this feature?

    #1298288
    Leo
    Staff
    Customer Support

    Sorry I’m a bit confused and I think there is a bit of miscommunication here.

    As far a I was aware using the H1 tag for a post or page’s title was the best option regarding the SEO of a site.

    That’s exactly what GP does.

    #1298299
    Joe

    If that is so then why do I have to do the following? I am waiting for a reply about where to add this code into the funtions.php. The Site Title will switch to H1 on the front page IF it is set to display the Latest Posts.
    For a static home page you will need to add this PHP Snippet:

    add_filter( ‘generate_site_title_output’, function( $output ) {
    return sprintf(
    ‘<%1$s class=”main-title” itemprop=”headline”>

    %3$s

    </%1$s>’,
    ( is_front_page() ) ? ‘h1’ : ‘p’,
    esc_url( apply_filters( ‘generate_site_title_href’, home_url( ‘/’ ) ) ),
    get_bloginfo( ‘name’ )
    );
    });

Viewing 15 posts - 16 through 30 (of 47 total)
  • You must be logged in to reply to this topic.