WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Change duplicate H1 tags for single pages (Twenty Eleven theme) (2 posts)

  1. JoeMayo
    Member
    Posted 2 years ago #

    In the Twenty Eleven theme for the single page posts it has two H1 tags. It has the blog title in a H1 tag and it has the post title in a H1 tag. I am looking for a way to chage the h1 tag for the blog title on single post pages to something else (div or h2). I believe this would be done in the header.php and/or single.php. From what I read it is a matter of replacing some code. Does anybody know how to do tis properly?

    Thanks

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    please do not edit Twenty Eleven directly but create a child theme http://codex.wordpress.org/Child_Themes to work with.
    it is important to have an unedited default theme in case of serious problems. also, a child theme will help to keep any customisations when you next upgrade your wordpress version.

    the blog title is done in header.php of Twenty Eleven:

    <h1 id="site-title"><span><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1>

    for how to have conditionally different html tags on the blog title, see for instance header.php or Twenty Ten:

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

Topic Closed

This topic has been closed to new replies.

About this Topic