WordPress.org

Support

Support » Themes and Templates » Homepage different code to internal pages

Homepage different code to internal pages

  • Christopher Roberts
    Member

    @christopherrobertswordpress

    Hi everyone, I have been trying to work out how to get the homepage to display the blog title as a h1 tag, whilst the internal pages just display it as standard text.

    I know this code

    <?php
    if ( is_home() ) {
    echo "<h1><a href='/' title='My homepage'>My sites name</a></h1>";
    } else {
    echo "<a href='/' title='My homepage'>My sites name</a>";
    }
    ?>

    displays the same on both pages except non-homepage pages show the text as a h1 tag, but I want the blog to fetch the sites name for me, so if I change it through WordPress and the database, the title changes without me having to edit the code.

    Any thoughts?

    Thanks 🙂
    Christopher

Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Homepage different code to internal pages’ is closed to new replies.