WordPress.org

Support

Support » Themes and Templates » H1 tag for homepage and single page

H1 tag for homepage and single page

  • I set H1 tag for blogtitle in homepage and for single page want to set H2 tag blogtitle
    but when i set H1 tag for homepage blogtitle, single post blogtitle also get get H1 tag cuz it include “wp-head”
    so what should I do?

Viewing 2 replies - 1 through 2 (of 2 total)
  • try and use a conditional statement;
    http://codex.wordpress.org/Conditional_Tags
    example:

    <?php if( is_home() || is_front_page() ) { ?>
    <h1>.....</h1>
    <?php } else { ?>
    <h2>.....</h2>
    <?php } ?>

    hat theme are you using?

    can you post the code you were editing?

    This is a sample of the final code (to complement the previous post)

    if(is_single() ){
         echo "<h1>" . bloginfo('name') . "</h1>"
    }else {
    echo "<h2>" . bloginfo('name') . "</h2>"
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘H1 tag for homepage and single page’ is closed to new replies.
Skip to toolbar