Title Override

Purpose

Ever needed to override a Page’s title?

Usually WordPress uses the actual title of the Page to populate the <title> tag.

Depending on your theme it may stick a few other things there as well – blog name, a tagline, etc. Most of us do not give it too much attention until we realise two fascinating facts:

  1. When someone bookmarks the page in their browser, contents of the <title> tag are automatically used as the of the bookmark. Given that the menu width is often limited, you really want the first few words of the bookmark to be meaninful to the user.
  2. Search engines still pay attention to the <title> tag! (probably because it is supposed to be “vewer-focused” and thus less subject to tampering than the “keywords” meta tag.

This plug-in allows you to keep your page titles the way you like them, yet define what is included into the <title> tag in the <HEAD> section of your Pages.

Scope

This is a simple tool for a simple task.

Title Override defines alternative titles for Pages only. Not for Posts. (Not unless someone convinces me that it is worth the effort).

Title Override deals with <title> tag only. Not with “keywords” or “description” meta tags – there are plenty of excellent plug-ins for that. Do not even ask me to go there.

What it does, how it works

1. Title Override adds an extra field into your administrative Page Edit screen. This is where you enter your alternate title:

example It effectively creates one more custom field and the fancy-shmency UI was not strictly speaking essential, but it does make things a bit less threatening for not computer-savvy users. Right?
2. There is no Options page – there is nothing to configure really.

3. Title Override installs a filter using wp_title() hook. If you enter anything into Title Override field – that is what wp_title() will output in your header (or wherever you use it). If you enter nothing, standard behavior of wp_title() will remain unchanged. So, if you activate this plug-in and never input anything into the Title Override field, there will be no impact on the output of your Pages (well, maybe a minor slowdown dues to a bit of extra processing).

4. For advanced users (comfy with editing header.php) Title Override includes an extra function: is_title_override()

Can you guess what it does? – Correct! It returns true if there is an alternate title defined for the current Page, and false otherwise. Now you can do something fancy like the example below:

<title>
<?php
if ( is_title_override() ) {wp_title();}
else: {
bloginfo('name');
_e(': ');
bloginfo('description');
_e(': ');
wp_title();
}
?>
</title>

I am sure you can thing of even more extravagant uses and would love to hear about them!

Credits

Title Override owes most of this code to the wonderful Headspace 2 plug-in. I did not ask its author John Godley for permission or help – his code was an inspiration enough. So, whan Title Override works – at least 80% of your thanks should be directed to John. When this plug-in horribly disfigures your server and ruins your marriage… I was going to put “the fault is mine” here, but read the disclaimer below!

Disclaimer

This is my first WordPress plug-in. I wrote it for my own purposes, not for public distribution. It is provided “As Is” and can probably do horrible harm.

I do not know PHP. I have never written a full PHP program in my life. Not even “Hello, World”. This means the code may be buggy and is guaranteed to be sub-optimal.

Parts of this plug-in came from other people’s code. I think I understand what they do, but not always why or how (this is especially true of the Ajax part).

Good luck!

Download

Have you read the Disclaimer above??? – download Title Override here: Title Override WordPress Plug-in Version 1.1.1

Installation

  1. Download the plugin (see “Download” above).
  2. Rename title-override.txt to title-override.php and put it into your plugins directory (/wp-content/plugins/) or in a sub directory of the plugins directory.
  3. Activate the Plug-in.
  4. Enjoy!

Change Log

Version 1.0, Dec 1′06 – original version with Ajax in the Edit screen.

Version 1.1, Dec 4′06 – no more Ajax – it was conflicting with the sidebar widget plug-in. Sorry, I am not smart enough to fix it. But the plug-in still works.

Version 1.1.1, Dec 9’06 – fixed a nasty bug that could make all your RSS feeds unacceptable to some readers. Sorry if it caused you trouble.

Thank you

Writing all this up took time and effort. If you happen to be actually using this plug-in – I appreciate your vote of confidence and would love to hear about it!



  1. thanks!

  2. THANK !!!

  3. cool, thanks for the work, i’ll give it a try and see how it goes…

  4. hi guys can you hel me to remove the title text in the header?

    I’d like to put an image there (with embedded text title),… how to do that?

    If I leaave the Blog Name text box empty in the user options (dashboard) the title will not appear in the header, but i want the title but it must not show.

    any ideas plz?

    thanks

  5. That is a bit beyond the scope of this plug-in. Sorry.

    In the order of decreasing complexity (and risk) your options are:

    1) If you are comfortable with PHP at all, you can edit your header.php – that’s what I did.

    2) Fiddle with your style.css. You can probably declare your blog name as invisible (but still occupying its space) with a background (the desired image).

    3) Find a plug-in that will take care of the problem

    4) Check if the option is already provided by your current theme. Many themes allow you to simply upload a header file. Unfortunately, they do it in different places, so I cannot be more specific.

    Good luck!

  6. Hi,
    Forgive me if this seems like a silly question…but how do I put the plug-in into the plug-ins directory? (I’m using wordpress.com). Where do I find it?

  7. you can’t. If you are with wordpress.com what they give you is what you get.
    Sorry 😦

  8. OK, thanks. So if I install the software on a different web host then I’ll see where to insert this plugin? (do all the files install in the same folder)?

  9. Ok, another question. your “not a blog” blog is on wordpress.com. I guess you wrote this plug-in for a blog hosted elsewhere?

  10. Shari,
    you got it right: this is a personal blog, so I do not care about making it perfect, just hassle-free.

    I also support several commercial Web sites based on WordPress. This plug-in was written for one of them.

    Keep in mind that stepping away from wordpress.com and going with another hosting service is a fascinating adventure. If you have a computer fobia, you will hate the experience. If you like to be in control, or enjoy graphic design, you will love it.

    There is a new plug-in out there (I do not recall the name off-hand) – it would take care of installing other plug-ins (I think it may have trouble running on Windows servers, but nobody hosts WordPress on Windows anyway). Should not be hard to find. It will make your life easier.

    When you pick a hosting service, look for one that offers WordPress hosting (not WordPress MU – that one is likely to have same limitations as WordPress.com).

    I would be the last person to say “do not do it”, but before you commit, you must understand that you will be taking up a new hobby. It will give you uncounted hours of joy, but will also tax your time. Of course, if this is a business need, just GO FOR IT!

    Good luck!

  11. Thanks!!
    I was a little annoyed that my “home” page title was “Home” and not the name of my site. So, with your plug-in I was able to change it to “Dean Logic”.

  12. Glad I could help, Dean!

    I am a huge believer in plug-ins that do just one thing, but do it well.
    Thanks for letting me know that it works!

    A>

  13. Hi!

    I would like extend my SQL experience.
    I red really many SQL books and would like to
    read more about SQL for my work as db2 database manager.

    What would you recommend?

    Thanks,
    Werutz

  14. Werutz, I am not exactly a DB2 expert and this is not the right place to discuss DB2’s implementation of SQL. If memory serves me right, there used to be a free edition of DB2 (for developers? ).
    Check it out.

    There is only one way to become a good DBA: practice. Go for it!

    A>

  15. […] Title Override – defines alternative titles for pages […]

  16. Уважаемые форумчане! Подскажите пожалуйста, как реализовать вот таким видом размещение информации???
    На многих сайтах такое вижу, а как сделать не пойму…
    В принципе, HTML я знаю, вот с PHP немного проблема…

    Ну например, вот на этих сайтах:
    Например тут

    или

    Например тут

    Я очень хочу вот так же оформить у себя новость!
    Заранее благодарен за ответы!

  17. […] Har du prvd denne? Title Override plugin […]

  18. Howdy I am so thrilled I found your website, I really
    found you by mistake, while I was searching on Bing for something else, Anyhow I am here now and would just like to say
    thanks a lot for a marvelous post and a all round exciting blog (I also love the theme/design), I don’t have
    time to go through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read more, Please
    do keep up the fantastic work.

Leave a comment


About

I am sorry you have to see this. Actually, I am not – if you came here, it’s you fault. When we choose our actions we also choose the consequences.

Despite my oversized ego I do NOT believe that anyone out there craves a daily dose of my insight. In fact, I am suspicious of people who think otherwise.

This blog is a tool.

I meddle with many complex computer deployments, and as I go through adding features and learning things, I also tend to forget numerous details and the reasoning behind the many choices I have made in the past. This is the place to document my adventures. And to give something back.

If you stumble upon this and find it useful – …good for you.