Site logo

Archived topic

GP + Marketer Site Title

10 replies · Started by Bill on August 21, 2019

Viewing posts 1–11 of 11

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

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 :)

Thanks Leo. No luck with that code.

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 :)

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

Got it. Thank you.

No problem :)

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

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

Thanks :)

This archived topic is closed to new replies.