WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] changing location of H1 tag in twentyten (11 posts)

  1. loversinc
    Member
    Posted 3 years ago #

    Hi

    I would like to change the location of the H1 tag in the twentyten template header but I do not really understand the code

    :'<div id="branding" role="banner">
    <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
    <<?php echo $heading_tag; ?> id="site-title">
    <span>
    " title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    <img id="logo" src="<?php echo home_url( '/' ); ?>wp-content/themes/twentyten/images/logo.png" alt="Elink Logo" />

    </span>
    </<?php echo $heading_tag; ?>>
    <div id="site-description"><?php bloginfo( 'description' ); ?></div>'

    At the moment, this code creates an H1 tag around an image file, the logo. I would like the H1 tag to go around some text, so in this case I would like it to go around the site-description. It would be great if someone could help me with the code I need to make this change.

    Thanks

  2. govpatel
    Member
    Posted 3 years ago #

    it is in style.css

    #site-title {
    float: left;
    font-size: 30px;
    line-height: 36px;
    margin: 0 0 18px 0;
    width: 700px;

    }
    #site-title a {
    color: #000;
    font-weight: bold;
    text-decoration: none;
    }
    #site-description {
    clear: right;
    float: right;
    font-style: italic;
    margin: 14px 0 18px 0;
    width: 220px;

    }

    This code is where you need make changes

  3. vijayrajesh
    Member
    Posted 3 years ago #

    Hi,

    I think mostly you need to edit on the PHP file only and rarely on the CSS.

    Can you tell me exactly where you need to put the h1 tag?

  4. loversinc
    Member
    Posted 3 years ago #

    thanks vijayrajesh

    I would like the h1 to go here: '<div id="site-description"><?php bloginfo( 'description' ); ?></div>'

    and not here: '<div id="branding" role="banner">
    <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
    <<?php echo $heading_tag; ?> id="site-title">
    <span>
    " title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    <img id="logo" src="<?php echo home_url( '/' ); ?>wp-content/themes/twentyten/images/logo.png" alt="Elink Logo" />

    </span>'

  5. vijayrajesh
    Member
    Posted 3 years ago #

    Hi loversinc,

    you want to convert site description into h1 tag?

  6. loversinc
    Member
    Posted 3 years ago #

    currently the logo is h1 tag and I would like the site description to be h1 tag instead.

  7. vijayrajesh
    Member
    Posted 3 years ago #

    Hi,

    Just replace "<div id="site-description"><?php bloginfo( 'description' ); ?></div>"

    with "<div id="site-description"><h1><?php bloginfo( 'description' ); ?></h1></div>"

    BUT IT IS IMPORTANT that the H1 tag font size will be different now. So, you may need to change the font style in css.

    Also, you may need to remove the h1 tag for logo. Because, In SEO, i think there should be only one h1 tag.

    Thank you,

  8. loversinc
    Member
    Posted 3 years ago #

    thanks for this.
    would you also be able to help me remove the h1 tag for the logo as it is not use in a way that I understand ' '<div id="branding" role="banner">
    <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
    <<?php echo $heading_tag; ?> id="site-title">
    <span>
    " title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
    <img id="logo" src="<?php echo home_url( '/' ); ?>wp-content/themes/twentyten/images/logo.png" alt="Elink Logo" />

    </span>'
    thanks

  9. loversinc
    Member
    Posted 3 years ago #

    Hi again, is anyone able to help with this?

  10. alchymyth
    Forum Moderator
    Posted 3 years ago #

    the header 'h1 tag' (which is actually a h1 or a div, depending on the page) is opened with these lines:

    <?php $heading_tag = ( is_home() || is_front_page() ) ? 'h1' : 'div'; ?>
    				<<?php echo $heading_tag; ?> id="site-title">

    and closed with this line:

    </<?php echo $heading_tag; ?>>

    make a backup copy of your working theme files before editing

    remove all these lines to remove the 'h1 tag' totally.

  11. loversinc
    Member
    Posted 3 years ago #

    thanks for this.

Topic Closed

This topic has been closed to new replies.

About this Topic