The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Web Design
    4. How to make my site title H1?

    How to make my site title H1?

    Web Design
    2 2 166
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Catinas97
      Catinas97 last edited by

      Hi

      In my Header.php I have the following php code for my title:

      <title><br /><?php<br />// Generate Page Title dynamically<br />if (is_home()) {<br />  bloginfo('name'); ?> - <?php bloginfo('description');<br />} elseif (is_category()) {<br />  single_cat_title(); ?> - <?php bloginfo('name');<br />} elseif (is_single()) {<br />  single_post_title();<br />} elseif (is_page()) {<br />  bloginfo('name'); ?>: <?php single_post_title();<br />} elseif (is_404()) {<br />  bloginfo('name'); ?> - <?php _e("Page not found", "fungames");<br />} elseif (is_search()) {<br />   bloginfo('name'); ?> - <?php _e("Search results for", "fungames"); echo esc_html($s, 1);<br />}<br />?><br /></title>

      This generates a good title different for every page/post I have on my site. But is now H1. I want the same code if, but with H1 tag somewhere in it. Cant figure it out how to do it!

      Can u help please?

      1 Reply Last reply Reply Quote 0
      • SamuelScott
        SamuelScott last edited by

        Here is what I use in the PHP files for pages and posts on my Wordpress sites:

        class="entry-title post-title">Name of Website Page

        Note: I don't think I've ever seen someone put the page title in the header file. You may want to move it to the template files for posts/pages.

        In your case, though, it may work just to put an H1 tag at the beginning and end of the whole thing:

        <title><br /><?php<br />// Generate Page Title dynamically<br />if (is_home()) {<br />  bloginfo('name'); ?> - <?php bloginfo('description');<br />} elseif (is_category()) {<br />  single_cat_title(); ?> - <?php bloginfo('name');<br />} elseif (is_single()) {<br />  single_post_title();<br />} elseif (is_page()) {<br />  bloginfo('name'); ?>: <?php single_post_title();<br />} elseif (is_404()) {<br />  bloginfo('name'); ?> - <?php _e("Page not found", "fungames");<br />} elseif (is_search()) {<br />   bloginfo('name'); ?> - <?php _e("Search results for", "fungames"); echo esc_html($s, 1);<br />}<br />?><br /></title>

        I hope this may help -- good luck!

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        • How much is the site architecture impacting my site?
          effectdigital
          effectdigital
          1
          6
          134

        • New ecommerce site: Close old site and full domain redirect or keep it linking to new site?
          GlobeRunner
          GlobeRunner
          0
          3
          371

        • Any body can help me to make my web site seo freindly?
          ClaytonJ
          ClaytonJ
          0
          4
          150

        • Is switching from a very old HTML table site to HTML5 going to make a big difference
          BobGW
          BobGW
          0
          4
          169

        • Wordpress Site Structure and H1 Tags
          evolvingSEO
          evolvingSEO
          0
          9
          350

        • Site Speed for Magento Site
          Felip3
          Felip3
          1
          10
          2.4k

        • Website title next to a post title-how to remove it?
          Rebeca1
          Rebeca1
          0
          13
          312

        • Spam site overtaken a client site
          EGOL
          EGOL
          0
          6
          137

        Get started with Moz Pro!

        Unlock the power of advanced SEO tools and data-driven insights.

        Start my free trial
        Products
        • Moz Pro
        • Moz Local
        • Moz API
        • Moz Data
        • STAT
        • Product Updates
        Moz Solutions
        • SMB Solutions
        • Agency Solutions
        • Enterprise Solutions
        • Digital Marketers
        Free SEO Tools
        • Domain Authority Checker
        • Link Explorer
        • Keyword Explorer
        • Competitive Research
        • Brand Authority Checker
        • Local Citation Checker
        • MozBar Extension
        • MozCast
        Resources
        • Blog
        • SEO Learning Center
        • Help Hub
        • Beginner's Guide to SEO
        • How-to Guides
        • Moz Academy
        • API Docs
        About Moz
        • About
        • Team
        • Careers
        • Contact
        Why Moz
        • Case Studies
        • Testimonials
        Get Involved
        • Become an Affiliate
        • MozCon
        • Webinars
        • Practical Marketer Series
        • MozPod
        Connect with us

        Contact the Help team

        Join our newsletter
        Moz logo
        © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
        • Accessibility
        • Terms of Use
        • Privacy