Missing Tag on Front Page

  • Author
  • #72895
    Power User

    Good evening,

    right now, I am trying to integrate an h1 tag to my front page. As you can see from the source code, I already have <h1> including the header background and the page title (<?php cryout_branding_hook();?>) but I am not sure if this is good enough. My home page (blog page named “Codex”) integrates it perfectly.

    I think that I have found the right code for fixing it in the theme-functions.php file:

    			$heading_tag = ( ( is_home() || is_front_page() ) && !is_page() ) ? 'h1' : 'div';
    			echo '<'.$heading_tag.' id="site-title">';
    				echo '<span> <a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" rel="home">' . get_bloginfo( 'name' ) . '</a> </span>';

    To me, it says that if it is either the home page or the front page and then it is also a page (not a post), then it will use the h1 tag and if not, the div tag is being displayed.

    As you can see from the h1 tag that includes it all (<?php cryout_branding_hook();?>), my front page is positively recognized as the front page since I worked with a condition using the particular reference (is_front_page()) to display it how it is right now (see header.php).

    So, how do I get <h1> in front of my site title for my front page only?

    I prefer not to use an h1 tag on the “Home” title since I would have to come up with a longer, SEO friendly title and it would then be displayed as long in the navigation. In fact, I would like to not display the “Home” title on my front page at all (only on the front page). So if you have an idea for this, too, please let me know 😛

    Kind regards,

    Website: earth-renewing.com

    Cryout Creations mastermind

    On the homepage it’s the site title that’s designed to use the H1 tag, not the page/section title.

    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
    Power User

    So it does not cause any issue if this whole snippet is included in the H1 tag?

    <h1><img id="bg_image" alt="* earth RENEWING" title="" src="https://earth-renewing.com/wp-content/uploads/2019/01/cropped-ER_header1300x300IC.jpg" /> <a href="https://earth-renewing.com/" title="* earth RENEWING" rel="home">* earth RENEWING</a> Flausen. Ideen. Visionen.</h1>

    And how would I prevent the display of the page title on “Home” only?

    Website: earth-renewing.com

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Missing Tag on Front Page’ is closed to new replies.