WordPress: Custom titles for individual post pages and categories

Posted in » Tutorials, Usability, WordPress - by Ades on June 4th, 2007

New to this blog? See our Popular Posts section to get started, we have tons of great articles that can benefit you. Don't miss the upcoming interesting articles, subscribe to our RSS.


Normally in WP there will be one title throughout your blog, even on individual post pages it will only show the blog title as the title of the page. This is not good for Search Engines.

As usual there is a fix for it, and it’s pretty simple to implement. It’s not a plugin, you just have to replace the existing “title” tag with the “new code” that will make this all happen.

This code will display: 1) The blog_name on the main page 2) the post title on individual post pages and 3) the blog_name + category_name for category pages. Just copy it and replace your existing title tag in the header.php (Your title tag might be in different php file, depending on the theme that you are using).

<title><?php if (is_home () ) { bloginfo(‘name’); }
elseif ( is_category() ) { single_cat_title(); echo ‘ - ‘ ; bloginfo(‘name’); }
elseif (is_single() ) { single_post_title();}
elseif (is_page() ) { single_post_title();}
else { wp_title(‘’,true); } ?></title>

Thanks to DailyBlogs for coming up with this solution. I believe this should be integrated to original WordPress themes.

[Post to Twitter]  [Post to Delicious]  [Post to Digg]  [Post to StumbleUpon] 


Related Posts




Post a Comment