WordPress.org

Ready to get started?Download WordPress

Forums

H1 tag for homepage and single page (3 posts)

  1. ali.sh
    Member
    Posted 6 months ago #

    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?

  2. alchymyth
    The Sweeper & Moderator
    Posted 6 months ago #

    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?

  3. Fiction Edge
    Member
    Posted 6 months ago #

    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>"
    }

Reply

You must log in to post.

About this Topic

Tags

No tags yet.