Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
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. :( –  toscho 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. –  toscho 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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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