[Resolved] GP + Marketer Site Title

Home Forums Support [Resolved] GP + Marketer Site Title

Home Forums Support GP + Marketer Site Title

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #990211
    Bill

    I’m using the Marketer theme from the library. I hooked a static area on the blog page and I have the Title as an H1.

    Would you have the code that would let me change the Site Title from an H1 to a p across the entire site?

    Thanks

    #990243
    Leo
    Staff
    Customer Support

    Hi there,

    Try 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>',
    			'p',
    			esc_url( apply_filters( 'generate_site_title_href', home_url( '/' ) ) ),
    			get_bloginfo( 'name' )
    	);
    } );

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

    Let me know if this helps πŸ™‚

    #991009
    Bill

    Thanks Leo. No luck with that code.

    #991018
    Leo
    Staff
    Customer Support

    I actually tested that code and it worked for me.

    Any chance you can link us to the site in question?

    You can edit the original topic and use the private URL field.

    Let me know πŸ™‚

    #991692
    Bill

    Can you take a look at my site to see if I can change the title tag with the above code?

    #991701
    Leo
    Staff
    Customer Support
    #991705
    Bill

    Got it. Thank you.

    #991725
    Leo
    Staff
    Customer Support

    No problem πŸ™‚

    #996072
    Ben

    Hello!

    Any way I could adapt your PHP code to make the site title (what appears next to the logo) an h1 only on the frontpage?

    I was thinking of trying this but couldn’t find the right template page to add to a child theme:

    https://wordpress.stackexchange.com/questions/88144/how-to-have-h1-for-site-title-only-on-homepage

    Thank you in advance!

    Regards,

    Ben

    #996090
    Ben

    So, I think I found the right file, and based on this I’m not sure why I have a p element for the site title on the frontpage. Maybe I missed some settings?

    // 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' )
    		) );

    Thanks again!

    Regards,

    Ben

    #996534
    Leo
    Staff
    Customer Support

    Any chance you can open a new topic for your question?

    Thanks πŸ™‚

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