Very easily. Open your header.php template and look for your
<title>
tag. Replace it with this. <title><?php if ( is_home() ) { ?><?php bloginfo('name'); ?><?php } ?> <?php if ( is_single() ) { ?> <?php } ?> <?php wp_title(); ?></title>
This will show Cooldomain on the home page.
And will show This is a example on the article page.
Uh oh i think i was mistaken.
It’s only a little problem. Now in the post page the title is :
>> Im a example of a title
The title is show with a >> sign.
Its posible to remove them? This will be better for Google, Yahoo and anothers.
Thanks again 🙂
Sorry about that. Revised code:
<title><?php if ( is_home() ) { ?><?php bloginfo('name'); ?><?php } ?> <?php if ( is_single() ) { ?> <?php } ?> <?php wp_title(''); ?></title>
You can read this for a little more help.
I use the Optimal Title plugin on mine. Thus my line looks like this:
<title><?php optimal_title(); ?><?php bloginfo('name'); ?></title>
On my homepage, this gives me Blogname.
On my single pages, this gives me Postname >> Blogname.
Works quite well and puts the post name in front of other things, while keeping the blogname there. Very nice, IMO.
You could achieve the same basic result as that without the Optimal Title plugin by doing this:
<title><?php
$sep = ' » ';
$titlestr = wp_title('',false);
if (!empty($titlestr)) echo $titlestr.$sep;
bloginfo('name');
?></title>
Ok, my title is correct now.
Thanks a lot. Your information is more hepful 🙂
Bye!