Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I´m using the Leaf Theme and in the header the following code can be found:

<?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 { ?>

                        <hgroup>
                            <h1 class="site-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
                            <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
                        </hgroup>

                        <?php } ?>

Right now the on all pages the site-title has the H1 tag and the site-description the H2 tag. I want this only on the homepage. On all other pages the title should have H6 and the description H7.

How can I do this?

The first part of the code is for when you use an image instead of title/description. I included it because it is included in the php if

share|improve this question
    
AFAIK, there is no <h7> tag... –  Joseph Feb 24 '13 at 1:17

1 Answer 1

This is one way...

<?php $headertag = ( is_front_page() ) ? 'h1' : 'h6'; ?>
<hgroup>
    <<?php echo $headertag; ?> class="site-title"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></<?php echo $headertag; ?>>
    <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup>
share|improve this answer
    
and a great way - it works! –  jnkr Feb 24 '13 at 2:05
    
Thanks so much! –  jnkr Feb 24 '13 at 2:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.