Tweaking WordPress blog title

wordpressWordPress offers endless scope for customizing, enhancing and tweaking, in addition to adding features through plugins. There is a vibrant development community out there, active all the time over the WordPress forums to offer a ready helping hand to the toddlers and tipplers. In addition,there are WordPress and PHP pundits busy writing tutorials on their web sites and blogs. There are hundreds of blogs on WordPress tweaks and tools and alone.

If you encounter a roadblock, all you have to do is to Google it out, rather copy and paste the exact error message and you will get at least 100 folks who would have posted different workable solutions all over the blogosphere, in addition to the WordPress forums.

I too try to help out noobs on the WordPress forums occasionally. But i thought why not I post in my blog all my tweaking experiences so that other folks who face similar situations can make use of solutions. That way much of legwork will be saved on their part. After all, a clever man is one who learns from others’ experience!

Her is one such teensy-weensy tweak I tried recently:

I have set up a “static home page” and the blog posts appear in a virtual “bog” page. But when I looked at the title of the web page when the blog posts are called through URL, it showed as follows:

Blog: Blog of Cyber Brahma – Mozilla Firefox

It looked weird. Why the term “blog” twice? The mischief was cause by this snippet found in the theme’s header.php:

<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>

But this code is deprecated in the > 2.5 versions of WordPress as per Codex. The explanation given by the Codex section for the “wp_title” template tag clearly explains the structure and variables to be used.

And I wanted only the blog’s name to appear on the title when the home and blog pages are shown; on all other pages, the blog name followed by the page/post title is to be shown; likewise in category and date-wise archives.

Well I used conditional tag called “if is_home” to tweak the title function call as follows:

<title><?php if (is_home()){ bloginfo('name'); } else { bloginfo('name'); wp_title('--',true,'');
} ?></title>

And it did the magic for me! (Please do not copy the code. Type it out on Notepad. Copying mouse-selected code from a web page rendering is a bad practice.)

The default “separator” between the post/page title and the blog name is right angle quote “»”, but I replaced it with an “en dash” (–) just for making a difference. Anyway it has nothing to do with the puritans quibbling over the petty semantics that the “»” character (&raquo;) is really a French close-quotation mark and it is semantically dubious to use it as an arrow! But it may be in French, but in universal internet lingua franca, it is accepted to be a textual-arrow symbol, in menus and navigation bars, and in crumbtrails (breadcrumbs).

More tweaks in coming days. Please stay tuned!

2 thoughts on “Tweaking WordPress blog title

  1. Kev

    Hi, Just testing out two things. I noticed a while back that in the wordpress forum you had problems when someone commented they were sent to a page that told them that the page they were looking for didn’t exist. Just wondered if you managed to solve the problem and if so, how.

    Hope you don’t mind me using this comment to contact you, you can always delete it later.
    Any help much appreciated


  2. S.K Post author

    Hi Kev,

    The problem was resolved after I re-uploaded the WordPress files.

    Hope you would have got the right page after posting your comments!

    Thanks for your visit.



Leave a Reply

Your email address will not be published. Required fields are marked *