<?php if (is_home() || is_front_page()) { $header_tag = 'h1'; }
else { $header_tag = 'h2'; } ?>
<<?php echo $header_tag;?>><?php the_title();?></<?php echo $header_tag; ?>>
Expanding on what Stephen Harris said, here is a useable example. Lots of different ways to use same code function.
Related Posts:
- Wrong site title and description in google search
- How Do I Set the Page Title Dynamically?
- ASCII titles with Yoast SEO plugin
- Is sanitize_title enough to generate post slugs?
- Auto Add Image Title,Caption,Alt Text,Description while uploading Images in WordPress
- Robots.txt not updating
- Adding rel=”next” & rel=”prev” for paginated archives
- NoFollow Entire Website
- Creating 301 Redirects for Post, Page, Category and Image URLs?
- How do I set up a custom URL shortener for my posts?
- Current post’s author name in the author meta tag
- Does the ‘WordPress Order’ feature, within the WordPress Dashboard, have any impact on site architecture?
- Replace URL with Site Title in Search Results
- WordPress page title repeated in SOME pages
- SEO – Two WordPress websites on same domain name
- Displaying Page Title on index.php
- add post content in meta description in yoast
- Migrating from other CMS to WP – losing SEO juice?
- Blog not indexed [closed]
- SEO meta description and title tag Yoast SEO
- Change sidebar headers from H1?
- Multiple Conditions for Child Page Title
- Remove date from Google Search Results Description
- How come my first blog post and my home page have the same title?
- Limit posts only on home page – ideally in functions.php
- Duplicate Australian E-Commerce site
- Customized title tag for each page in pagination?
- Why doesn’t YoastSEO allow me to set the title/description for the home page? [closed]
- Add image tags to native WordPress XML Sitemaps
- is_home() in HTML head
- What does short_ping do?
- Remove site name from title post
- Disallow author with robots.txt
- Seo WordPress Pages on google [closed]
- Hard code a domain into Yoast SEO canonical URLs
- How to remove duplicate blog title
- Add title, post content, and category like add_post_meta and update_post_meta
- Set different Canonical url programmatically for every post
- Adding schema.org itemprop to WP4.1 Title Tag
- What does it mean by “Home page / Archives” in JetPack Site Stats? [closed]
- WordPress Blog and SEO
- Woocommerce: How to remove page title from storefront theme homepage
- Header style different on home and remaining pages
- Will using REST API impact SEO? [closed]
- How to Appease the Google PageSpeed Gods with regards to image optimization?
- alt tags of the images are not saving/emtpy
- Enabling compression in .htaccess file is causing 500 internal error
- Dynamically change page title from URL param
- robots.txt Not Updating
- is it good to use WordPress in the same url extension in terms of seo?
- How to solve Robots.txt problem with WordPress fresh install?
- Yoast SEO: title tags are repeating my website name and slogan [closed]
- Changing the title tag from a shortcode
- How to ensure that a landing page created with WordPress does not enter the sitemap?
- How may I see all the pages on my wordpress website and see when they were created?
- Reactjs headless WordPress theme configure SEO
- How to Change The Title in WordPress For SEO
- Change title only in dynamic page
- Search Console detects Category Pagination data as Duplicate Meta Description
- SEO optimization gone not so well
- Modify conditional titles to include parent and page number
- How to set the seo title tag on a page by page basis?
- Automatic SEO for wordpress [closed]
- Where does Yoast SEO plugin sets the site/page title?
- How to output the title of the blogs home page
- Try to run a function only on Home
- How to hide sensitve page from google spiders and non-membres in wordpress!
- Using a conditional tag for the home page banner
- Custom Canonical URLs
- Wrap the_title_attribute in a H2 within a Conditional Tag?
- What is/are the best thing(s) I can do to make my WordPress blog more popular? [closed]
- how to set title of each page or post for SEO
- Show Sitename on Yoast SEO Title tag [closed]
- Change description of my Jetpack facebook shared links [closed]
- Homepage meta title and description not showing in search engines?
- Search Engine Visibility checkbox after indexed
- how to 301 redirect from a plugin folder
- Can I change the “Home” text in the menu?
- best way to stop this wordpress duplicate content
- Embed sitemap in a page
- charset problem in wordpress because of nginx config
- Is Shared server effect SEO
- How to display featured image description and title?
- wp_strip_all_tags [closed]
- Yoast taking over my WordPress title tag [closed]
- How to stop showing my under development site on Google Search [closed]
- How to remove WordPress Virtual Robots.txt that keeps overriding my root robots.txt? [closed]
- Change meta data of pdf file
- Show different title on category page
- Updating old website links to new website links [closed]
- Search results show a different site [closed]
- Fix description of website on Google Search result
- Site shows URL instead of “meta title” after deleted few plugins (not any SEO plugin was deleted)
- Is it possible to create slug on homepage and how?
- SEO is not working on pages [closed]
- How can I get $pagenow equals to the Home Page or specific page on my site?
- How to get Title of Home Page to Appear on Page
- Google isn’t able to search my website
- Pinging or sitemap plugin: which practice is better
- How do I create custom tags for WordPress SEO? [closed]