Archived topic
how to add h1 tag into my website
6 replies · Started by Phat on August 7, 2018
Hi there,
how have you constructed the home page? And where do you want to put the <h1> ?
I want H1 is homepage title "Mã Vạch Shop"
Could you help me?
Thanks
Phat
I want H1 is Website Name "Mã Vạch Shop"
Hi there,
the Site Title should only be set as a H1 if there is no other H1 being used on the page. As you front page doesn't have one you could add this PHP snippet:
add_filter( 'generate_site_title_output','tu_frontpage_h1_title' );
function tu_frontpage_h1_title() {
printf(
'<%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' )
);
}
Adding PHP: https://docs.generatepress.com/article/adding-php/
For the other pages you could use a GP Page Header:
https://docs.generatepress.com/article/page-header-overview/
In particular you could add the title in the Page header content like so <h1>{{post_title}}</h1> that will pull in the title of the post automatically.
Hi, Im my homepage hasnt any h1 title.
Im had check the option of hide page title and Im using a image.
I had added that code using Code Snippet Pluging, but SEO Meta in 1 Click extension says that not h1 was found.
any help?
thank
Hi there,
can you provide a link to your site ? With the above code added ?
You may want to start your own topic so you can use the Site URL filed to share the link privately.