WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] change title tag only on main page (3 posts)

  1. navigadget
    Member
    Posted 8 years ago #

    I want to change the title of my front page so that it shows:

    blog name -- blog description

    This is the code I have right now:
    <title><?php wp_title(' '); ?><?php if(wp_title(' ', false)) { echo ' --'; } ?> <?php bloginfo('name'); ?></title>

    I don't want to change its behaviour anywhere else though.
    All other pages I'd like to keep:
    post title -- blog name
    category name -- blog name

    Can anyone help me?

  2. moshu
    Member
    Posted 8 years ago #

    Topic title misleading: you want to change the <title> tag. You could use some conditionals: http://codex.wordpress.org/Conditional_Tags

    [topic title corrected]

  3. navigadget
    Member
    Posted 8 years ago #

    This seems to do what I want. Thx for the help.
    <title>
    <?php if (is_home())
    {
    bloginfo('name');
    echo ' -- ';
    bloginfo('description');
    }
    else
    { ?>
    <?php wp_title(' '); ?>
    <?php if(wp_title(' ', false))
    {
    echo ' --';
    } ?>
    <?php bloginfo('name');
    } ?>
    </title>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags