I’ve received more than a few emails asking me how I got my blog home page to say “Make Money Online with John Chow dot Com” while all my other pages show the default title and blog name.
Normally, WordPress shows the home page title as name of the blog and the tagline. In my case, it would be John Chow dot Com >> The Miscellaneous Ramblings of a Dot Com Mogul. When I decided to go after the make money online keywords, I changed the title of the home page to add those words in. However, I didn’t want to change my tagline in order to do that. This is where Justin from My PC Rig came in. Justin is a coding genius and showed me how to mod my blog header file to achieve the desired result.
Do I Hear An Echo?
To give your blog home page a custom title that is not tied to your blog name or tagline, you need to insert an echo command. Log into your server and find the header.php file in your blog theme folder. Look for the following codes. This was taken from the Mistylook theme so your header codes maybe a bit different.
<title><?php bloginfo(‘name’); ?> <?php if ( is_single() ) { ?> » Blog
Archive <?php } ?> <?php wp_title(); ?></title>
Add the following echo command in front of the code that calls up the title.
<title><? if ($_SERVER["REQUEST_URI"] == "/"){
echo "Make Money Online with John Chow dot Com";
}else{
?>
<title><?php bloginfo(‘name’); ?> <?php if ( is_single() ) { ?> » Blog
Archive <?php } ?> <?php wp_title(); ?></title>
If you run the Optimal Title plugin, like I do, then the codes will look like this.
<title><? if ($_SERVER["REQUEST_URI"] == "/"){
echo "Make Money Online with John Chow dot Com";
}else{
?>
<? optimal_title(‘«’); ?><?php bloginfo(‘name’); ?> <?php if (!optimal_title(”, FALSE)) bloginfo(‘description’); ?> <? } ?></title>
What the above change does is tell WordPress to use the standard name and tagline as the title for every page except the home page. If a reader goes to the home page, it will show whatever you entered in the echo.