WordPress: Custom titles for individual post pages and categories
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.
|
Related Posts |




