WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Title info for a home page

[Resolved] Title info for a home page

  • So I am new to WP. I have created my static pages and have the “Home” page going to the static page I created. But I cannot seem to get the title tag populated with the word home or anything else for that matter.

    Here is some code :
    header.php

    <title><?php if (is_single() || is_page() || is_archive()) : ?><?php wp_title('',true); ?> | <?php bloginfo('name'); ?><?php else : ?><?php bloginfo('name'); ?> - <?php bloginfo('description'); ?><?php endif; ?></title>

    This works for all the other pages and posts but not for the home page that I created. Do I need to physically add it in with an if/then statement?

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    @esmi

    Forum Moderator

    Try:

    <title><?php if( _is_home() || is_front_page() ) :?> Home | <?php bloginfo('name'); ?><?php elseif (is_single() || is_page() || is_archive()) : ?><?php wp_title('',true); ?> | <?php bloginfo('name'); ?><?php else : ?><?php bloginfo('name'); ?> - <?php bloginfo('description'); ?><?php endif; ?></title>

    Thanks for the code esmi, however that code now breaks the site. Nothing appears but a white page.

    EDIT:

    Found the error in the code _is_home needs to be is_home

    esmi

    @esmi

    Forum Moderator

    Sorry about that. 🙁

    No worries, thanks for the help.

    I am not a big php guy. can you explain what this means or is doing?

    <?php if( is_home() || is_front_page() ) :?>

    esmi

    @esmi

    Forum Moderator

    If this is the main (default) blog page (is_home()) or (||) it’s a static front page (is_front_page())…

    http://codex.wordpress.org/Conditional_Tags

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Title info for a home page’ is closed to new replies.
Skip to toolbar