Change title tag on Index page only (4 posts)

  1. rabramson
    Posted 5 years ago #


    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,


  2. Michael
    Forum Moderator
    Posted 5 years ago #

    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>


  3. CounterDax
    Posted 5 years ago #

    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.

  4. rabramson
    Posted 5 years ago #

    Thanks, everyone...I will try it!

Topic Closed

This topic has been closed to new replies.

About this Topic