-1

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

1
  • AFAIK, there is no <h7> tag... Feb 24 '13 at 1:17
0

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>
1
  • and a great way - it works!
    – jnkr
    Feb 24 '13 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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