- This topic has 10 replies, 3 voices, and was last updated 2 years, 8 months ago by
Leo.
-
AuthorPosts
-
August 21, 2019 at 6:37 pm #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
August 21, 2019 at 8:57 pm #990243Leo
StaffCustomer SupportHi 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 π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 22, 2019 at 12:20 pm #991009Bill
Thanks Leo. No luck with that code.
August 22, 2019 at 12:29 pm #991018Leo
StaffCustomer SupportI 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 π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 23, 2019 at 8:55 am #991692Bill
Can you take a look at my site to see if I can change the title tag with the above code?
August 23, 2019 at 9:02 am #991701Leo
StaffCustomer SupportI believe this post should offer some insight:
https://generatepress.com/forums/topic/site-name-title-tag-search-results/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 23, 2019 at 9:08 am #991705Bill
Got it. Thank you.
August 23, 2019 at 9:27 am #991725Leo
StaffCustomer SupportNo problem π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 29, 2019 at 1:22 am #996072Ben
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
August 29, 2019 at 1:36 am #996090Ben
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
August 29, 2019 at 10:16 am #996534Leo
StaffCustomer SupportAny chance you can open a new topic for your question?
Thanks π
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.