John Chow dot Com Online Investment Review - Make Money Online Investing in Businesses
 

How To Make A Custom Home Page Title

written by John Chow on May 31, 2007

How to make $593 in less than one hour

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() ) { ?> &raquo; 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() ) { ?> &raquo; 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(‘&laquo;’); ?><?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.

Did you enjoy this post? Get John Chow Dot Com updates via email...

Stay up to date with all of John Chow’s tips for making money online and blog posts by subscribing via email. Your email will be kept private and never shared with anyone.

{ 31 comments }

Alex May 31, 2007 at 6:19 pm

And do u use optimal title? Add an example with Optimal Title Plugin :p

John Chow May 31, 2007 at 6:36 pm

Sure! Done!

AndyDang May 31, 2007 at 6:45 pm

Great Stuff John. As you can see on my site, I definitely abused my home page title. And yes, my name is #2 on google. One more to go. Thanks John!

Blogging with Desi Baba May 31, 2007 at 7:31 pm

Well done John. I’m still learning how to modify my template.

Success Online May 31, 2007 at 8:12 pm

John thanks for reading my mind. I have been trying to work with the other tips you put out. I’m out of the comfort zone with the SEO and site design and all the other languages you experts understand! Congratulations on knowing those skills!

Ankur June 1, 2007 at 8:00 am

Maybe he has some :twisted: scheme behind this. *Joking*

You always confuse me if you are evil or not, soo evil john.

Ok, real point,

Does anyone know anything for wordpress.com blogs?

Nomar June 1, 2007 at 12:50 am

Good Chow, thanks for sharing, I was wondering to how you did that.

Jez June 1, 2007 at 8:11 am

There is an “is_home” variable you can test against instead of testing against the URI… not that it really matters…

Eric June 1, 2007 at 9:17 pm

To add to this, there are a bunch of built in WP functions like this.

is_search() — Search Query
is_page() — Manually added “static” page
is_post() — Normal posts
is_single() — Is there just one item on the page (ie not front/category pages).

I’m sure there are more, but with those you can do some tricky things.

Eric June 1, 2007 at 9:18 pm

Oh, and I think they are all functions..

so you need to test using

if (is_home()) {
// Do Whatever.
}

You can also do the inverse, notice the bang (!), which basically means NOT.

if (!is_home()) {
// Do whatever.
}

Steven May 31, 2007 at 6:43 pm

Very nice. I didn’t even notice it until you post about it lol

Daniel May 31, 2007 at 7:04 pm

I’ve actually wondered how to do this. I noticed it on your blog as well as a few others. Thanks for the code!

cikgu azleen May 31, 2007 at 7:26 pm

Can use SEO Title Tag plugin also.. can download it from here.. http://www.netconcepts.com/seo-title-tag-plugin/

Brilliances June 1, 2007 at 4:57 am

Yeah… I’ve just recently installed SEO title plugin aswell. It was broken a month or so ago but now works like a charm. Highly recommended. Hate having to custom hack wordpress

Wahlau.NET June 1, 2007 at 6:55 pm

thanks for the heads up

Ankur June 1, 2007 at 8:03 am

Its good, but for one flaw.

:arrow: You have to rename every post individually!

Dave May 31, 2007 at 7:35 pm

Glad you took my advice and made a post about this, now I have the information archived somewhere :)

SEO Blog May 31, 2007 at 8:16 pm

Optimal Title sucks! It’s not compatible with other plugin plus you have to dig around to configure it =(. Check out my post on the “Top WordPress Meta-Tag Plugins List” for the ‘Ultimate Meta-Tags’ plugin (scroll down to the very end :roll: and, yes, this plugin can not only insert the title tag but also pretty much ALL of the meta tags :) . Enjoy guy!

SEO Blog May 31, 2007 at 8:17 pm
Vivek May 31, 2007 at 8:18 pm

Try this my friend, a recommended way

<title>
<?php if(is_home()) {
echo 'Make Money Online with John Chow dot Com';
}
else { ?>
<?php bloginfo(’name’); ?> <?php if ( is_single() ) { ?> » Blog
Archive

SEO Blog May 31, 2007 at 8:29 pm

*Also, all you need for the title is these code between the title tags:

I explain why this simple structure is the best title config for SEO on my blog. The post, I think, is under the related post entries in the above ‘Top Wordpress Meta-Tag Plugins List’.

O.K. Gtg….

Ankur June 1, 2007 at 7:55 am

Ok SEO blog, no offense, but those Three posts are actually supposed to be One :?:

Scott Yang May 31, 2007 at 8:46 pm

Instead of hard-coding a check on $_SERVER['REQUEST_URI'], you can just use the WordPress function is_home(), i.e.

if (is_home()) {
// my homepage title goes here
} else {
// my archives/single page title goes here
}

Jeff Kee June 1, 2007 at 2:26 am

There’s an easier function than

$_SERVER["REQUEST_URI"] == “/”

It’s is_home or is_page(home) or something like that… I’ll have to look it up quickly.

Ankur June 1, 2007 at 8:07 am

Could you explain it a little better please?

Tony June 1, 2007 at 7:53 am

Wordpress out of the box is extremely bad for supplemental results.You need to add a unique page title and page description to every post. If you can’t make your own plugin which allows you todo this for every post then there are a couple of 1/2 decent plugins that do it automatically. One is called Add-Meta-Tags it isn’t perfect but it is heaps better than the standard fare from wordpress. It also automatically adds unique page titles and page descriptions to all your old posts which can be handy if you have a couple of hundred posts.

Success Online June 1, 2007 at 7:56 am

Well then we will have to look into this one. Thanks for sharing. :cool:

Ankur June 1, 2007 at 7:57 am

Ok, anybody here can do a evil trick and create some script for other platforms like Blogger or Xanga?

That will make a great update and greater value for John’s post, and a :twisted: linkback with good traffic.

NOW, thats :idea: :arrow: :twisted: :arrow: :twisted:

Erik (DeveloperDose.com) June 1, 2007 at 7:41 pm

Thanks for the hack, very useful Wordpress trick.

Lejer June 3, 2007 at 11:21 am

So many people giving advices.
Well… php rocks for wordpress:) If you know just a bit of, you can make a lot.
about $_SERVER: there’s the simple way
is_home, or is_something… it’s on the WP framework:) Why should i look for something (waste time) when it’s so easy to just put it there?:)

Notice: for ones that have their blogs in a subfolder, request_uri should be properly set. For those, is_home it’s the simple way:)

And… i’m using the $_SERVER method to have a my own location for readers.

a.erol June 4, 2007 at 6:34 am

nice way around. thanks to Chow & SEO Blog..