WordPress.org

Ready to get started?Download WordPress

Forums

Quark
[resolved] Blog title/name only on homepage as (3 posts)

  1. slamjam
    Member
    Posted 6 months ago #

    Hi, me again

    I would like to have the Blog Name/Title as <h1> on my homepage, and as <span> on all my other pages. I have found a code snippet somewhere to do that:

    <?php if(is_home()) { ?>
    <hgroup>
    <h1 class="site-title"><a href="<?php echo esc_url( 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 } else { ?>
    <hgroup>
    <span class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span>
    <span class="site-description"><?php bloginfo( 'description' ); ?></span>
    </hgroup>
    <?php } ?>

    I have tried to get that working with your theme, but messed up everything. I am not sure where to place the code in the header.php. I know that i can't copy and paste, but not much more.

    Help would be great

    kind regards

  2. Anthony Hortin
    Member
    Theme Author

    Posted 6 months ago #

    Within header.php, around line 48, you'll see where it creates the header in a H1 tag. You'll need to put your loop around this.

    <?php if( is_front_page() ) { ?>
       ...existing code goes here...
    <?php } else { ?>
       ...your new title with span goes here...
    <?php } ?>

    On a side note, hgroup has been removed from the html5 specification, so it's probably not a good idea to use that. http://html5doctor.com/the-hgroup-element/

  3. slamjam
    Member
    Posted 4 months ago #

    Thx Anthony, and sorry for the late reply.

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.