3

My main problem is around the title. In my index.php, I have specified a title tag and inserted the following:

<?php wp_title(); ?> | <?php bloginfo( 'name' ); ?>

My problem is the it is only printing the blog "name" - wp_title() prints nothing

i.e. This is what is being printed from the above:

| Wordpress Test Site

NOTE: The Page Title should be: Home

Strangely, when I visit My Sample Page, it presents the following:

» Sample Page | Wordpress Test Site

And they are both using the same header.php file!

Am I missing a setup somewhere that doesn't work on the home page?

FYI - I've set the Page - Home as the static front page.

Thanks

1

1 Answer 1

5

The title is empty at the front page in WordPress. Yes, that sucks.
Just put the separator into wp_title():

<title><?php
//        separator, print immediately, separator position
wp_title( '·',       TRUE,              'right' );
bloginfo( 'name' );
?></title>

This prints out just the blog name on the front page and PAGE NAME · BLOG NAME on other pages.

5
  • thanks - I also looked into the function is_home() to print a static title Commented Feb 27, 2012 at 21:19
  • 1
    is_home() fails sometimes on multisite installs. Not reliable. :(
    – fuxia
    Commented Feb 27, 2012 at 21:27
  • actually, is_home() doesn't work - is_front_page() is the ticket! Commented Feb 27, 2012 at 21:29
  • Same problem on multisite. For a breadcrumb plugin I wrote recently I had to hack around this bug.
    – fuxia
    Commented Feb 27, 2012 at 21:31
  • thanks for feedback - this is a single basic site so should be ok Commented Feb 27, 2012 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.