• Resolved tizz

    (@tizz)


    The theme has the <h1> tag in the menu, not in the title of the blog. So for the homepage, I put the <h1> on the title of the blog, and in the call to the menu I replaced with the <h2> tag, in this way:

    <h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="crossroad" />
    </a></h1>

    and

    <h2 class="assistive-text"><?php _e( 'Menu', 'leaf' ); ?></h2>

    Now the home page is 100% SEO.
    The problem is that all the other pages (single, archives, etc) show two <h1>, blog’s title and post’s title, and that’s no good.
    I’d wish there was only one <h1>, for the post’s title, removing the one on the title of the blog, for all pages except the home page.
    Maybe it would be possible with a basic code like this in the header:

    <?php if(is_home() || is_front_page()) {?>
      <h1><?php bloginfo('name');?></h1>
    <?php } else { ?>
      <?php bloginfo('name');?>
    <?php } ?>

    But I don’t know how to replace or add to the original, which is this:

    <?php $header_image = get_header_image();
    if ( ! empty( $header_image ) ) { ?>
    
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
    </a>
    
    <?php } else { ?>

    Can you help me please?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author bradthomas127

    (@bradthomas127)

    Hi tizz, thanks for all your help with support.

    I kind of under stand what your trying to do.

    Have you took into account that this theme is html5? the spiders are able to understand whats in the header <header>, navigation <nav>, post/page <article> – <section>, sidebar <aside>, and footer <footer>. Its not like old html4 and below where everything was div’s <div>. This theme is about under the same standards as twentytwelve.

    Let me know what you think and i’ll try to help you out with what your trying to do.

    -Brad

    Thread Starter tizz

    (@tizz)

    Hi Brad, first of all thanks for your kind reply.
    A Firefox addon called SEO Doctor gave me bad results with the original header.php file.
    I’ve fixed something (not depending on theme), but now I’d like fix H tags.
    I know very little about HTML 5, and if you’re telling me that I don’t have to take tool results into account because that facet doesn’t consider HTML 5 standard compliance mode, I believe you and I’ll stop worryin’ about it.
    Anyway, for what concerns H tag, with original file results are:

    in home page no problems (one H1 tag “Menu” and good H2 tags – but I don’t understand why H1 on Menu and not on blog title) but with single, category, archives and tags pages results are bad because I have 2 or more (depends on page, category can be 15) H1 tags, and no H2 tags at all, example:

    single page – 2 H1 tags (1 is post title, the other “Menu” I suppose)
    no H2 tags

    categories pages – 15 H1 tags (archive title)
    no H2 tags

    archives pages – 3 H1 tags (month year)
    no H2 tags

    tags pages – 15 H1 tags (tag title)
    no H2 tags

    So I modified header.php like I said above, removing H1 from “Menu” and assigning H2, and giving H1 to blog title.
    In this way home page results are very good (100%), and better in all other pages (99%-98%), but I’d like that in single page H1 was on post title (H2 now is on Menu), and I’d like that in archives pages H1 was on blog or archive title, and H2 on posts titles, because I don’t care of Menu. Now with modified file results are:

    single page – 2 H1 tags (1 is post title, the other is blog title I suppose)
    OK H2 tags (H2 menu)

    categories pages – 15 H1 tags
    OK H2 tags (H2 menu)

    archives pages – 3 H1 tags (month year)
    OK H2 tags (H2 menu)

    tags pages – 15 H1 tags (tag title)
    OK H2 tags (H2 menu)

    I hope it’s clear, it’s a bit confusing.
    I think that I could leave in this way (results are not bad now), but at least fix only all of that H1 tags.
    I’m here for learning, and I don’t know if all this makes sense in HTML5, or at all.

    Theme Author bradthomas127

    (@bradthomas127)

    I think you are alright Tizz, pages with categories/Tags have alot but they are all wrapped in <article> tags eg.

    <article>
      <header>
        <h1 class="entry-title">Title</h1>
      </header>
    </article>
    
    <article>
      <header>
        <h1 class="entry-title">Title</h1>
      </header>
    </article>

    And so on.

    Get a hold of me though my contact form so i can give you better support, probably cant get back to you till tomorrow though.

    Also Read this And watch this video from Google’s Matt Cutts.

    I have this advertising blog, where individual posts are Ok, but in the blogs home page every posts excerpts have H1 tags and that caused a problem. My blog home page has now 10 H1 tags!!

    I would request you to please have a look at it and let me know the resolution, if possible. I don’t know much about WP theme coding 🙁

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    @vjlamba, your theme’s forums are here: http://forums.appthemes.com/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘H1 in home page and other pages’ is closed to new replies.