WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Title info for a home page (6 posts)

  1. designerken
    Member
    Posted 4 years ago #

    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?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    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>

  3. designerken
    Member
    Posted 4 years ago #

    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

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Sorry about that. :-(

  5. designerken
    Member
    Posted 4 years ago #

    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() ) :?>

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.