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

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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