Support » Fixing WordPress » Change title tag on Index page only

  • Hello,

    I recently added this line of code to my header.php file so that the name of the post appears in the individual post title tag: <title><?php wp_title(‘-‘,’true’,’right’); ?><?php if ( is_single() ) ?><?php bloginfo(‘name’); ?></title>

    However, I would like my index page to have a unique title tag that will not appear in other title tags of my site.

    Can someone tell me which template needs to be altered and what new tag needs to be inserted?

    Note I am using the Copyblogger theme.

    Many thanks,


Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael


    Forum Moderator

    use a conditional tag to enter the title tag for the index page;

    <title><?php if( is_front_page() ) { echo 'unique title tag'; } else { ?><?php wp_title('-','true','right'); ?><?php if ( is_single() ) ?><?php bloginfo('name'); ?><?php } ?></title>

    Do watch out with using the is_front_page() function since in some cases, such as with custom front pages, it will also return true when on a custom articles front page (thus not only the cover front page)…

    In that case, you can filter for the page name, too:

    if( is_page('page-slug-or-name-or-id') ) {
      echo 'unique title tag';
    } ?></title>

    Mix and match till you get what you want.

    Thanks, everyone…I will try it!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change title tag on Index page only’ is closed to new replies.