[Resolved] Remove doble h1 in my home page

Home Forums Support Remove doble h1 in my home page

  • This topic has 8 replies, 3 voices, and was last updated 12 months ago by Tom.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1240619
    Felipe

    How to remove the double H1 that my website has? I need that there is only one H1 and that this is not that of the Header, but that of the text that I put with a hook in the home page.

    #1240628
    Felipe

    I trying modify this block code, but not working for me.

    // Build our site title.
    		$site_title = apply_filters( 'generate_site_title_output', sprintf(
    			'<%1$s class="main-title" itemprop="headline">
    				<a href="%2$s" rel="home">
    					%3$s
    				</a>
    			</%1$s>',
    			( is_front_page() && is_home() ) ? 'h1' : 'p',
    			esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
    			get_bloginfo( 'name' )
    		) );
    #1240718
    Leo
    Staff
    Customer Support

    Hi there,

    Try this PHP snippet here:
    https://generatepress.com/forums/topic/gp-marketer-site-title/#post-990243

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

    This should make the site title to be a <p> instead of <h1>

    #1240754
    Felipe

    Thank you very much, I just added it with the help of the code “Code Snippets” and I have placed it like this:

    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() && is_home() && !is_paged()) ? 'p' : 'h1',
    			esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
    			get_bloginfo( 'name' )
    	);
    } );

    πŸ˜‰

    #1240761
    Felipe

    How I remove URL input field in comment form?

    #1240766
    Felipe

    Well, i use this snippet

    add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
    function tu_add_comment_url_filter() {
        add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
    }
    
    function tu_disable_comment_url($fields) {
        unset($fields['url']);
        return $fields;
    }
    #1240843
    Tom
    Lead Developer
    Lead Developer

    Looks good to me. Everything working as it should now? πŸ™‚

    #1240845
    Felipe

    yes, sir, thank!

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