How To Make A Custom Home Page Title

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.


32 thoughts on “How To Make A Custom Home Page Title”

  1. Alex says:

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

      1. AndyDang says:

        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!

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

      3. 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!

        1. Ankur says:

          Maybe he has some 😈 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?

      4. Nomar says:

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

    1. Jez says:

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

      1. Eric says:

        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.

      2. Eric says:

        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.
        }

  2. Steven says:

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

  3. Daniel says:

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

  4. cikgu azleen says:

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

    1. Brilliances says:

      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

      1. Wahlau.NET says:

        thanks for the heads up

    2. Ankur says:

      Its good, but for one flaw.

      ➑ You have to rename every post individually!

  5. Dave says:

    Glad you took my advice and made a post about this, now I have the information archived somewhere πŸ™‚

  6. SEO Blog says:

    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 πŸ™„ and, yes, this plugin can not only insert the title tag but also pretty much ALL of the meta tags :). Enjoy guy!

  7. Vivek says:

    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

  8. SEO Blog says:

    *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….

    1. Ankur says:

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

  9. Scott Yang says:

    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
    }

  10. Jeff Kee says:

    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.

    1. Ankur says:

      Could you explain it a little better please?

  11. Tony says:

    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.

    1. Well then we will have to look into this one. Thanks for sharing. 😎

  12. Ankur says:

    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 😈 linkback with good traffic.

    NOW, thats πŸ’‘ ➑ 😈 ➑ 😈

  13. Thanks for the hack, very useful WordPress trick.

  14. Lejer says:

    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.

  15. a.erol says:

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

Comments are closed.