Often times, the <title> tag is overlooked when creating a theme. This tutorial will help you optimize the <title> tag for your specific needs.
I’m a huge fan of optimizing my <title>, but it takes some work to do it.
In any thing I create or modify, I always have a separate title.php file because I normally have 10-15 lines in the file for my <title>.
Here is what I use,
<title><?php
if(isset($_GET[author_name])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
if(is_home()) { echo ‘My News Site.’; }
elseif(is_single()) { the_title() . ‘ - My News Site.’; }
elseif(is_date()) { echo ‘Site Archives - ‘ . get_the_time(’M Y’); }
elseif(is_category()) { echo single_cat_title() . ‘ News - My Site’; }
elseif(is_page()) { the_title(); }
elseif(is_search()) { echo ‘My News Site Search: ‘ . $s; }
elseif(is_tag()) { echo single_tag_title(’My Site Tag: ‘,true); }
elseif(is_author()) { echo ‘Site Author - ‘ . $curauth->display_name; }
else { echo "Sorry, page not found."; }
?></title>
Then, to simple include this file in your theme, use <?php include(’title.php’); ?> where you would normally have the <title> and it will show up as planned.
The reason I do this for my <title>’s is because the default method used in WordPress has never been satisfactory for me. Additionally, and primarily, I have seen far better SEO results because of this.
Related Stuff
Improving security in Wordpress plugins using NoncesUsing a nonce (number used once) is the best way to protect your plugin against a cross-site request forgery (CSRF) hacker-attack. Nonces ...
10 New WordPress PluginsThis plugin enable admin to put up a splash page to show that the site is down for maintenance. Come with a timer to tell how long the site ...
WordPress Forums Plugins To Build CommunityGrowing your blog beyond publishing can be done quite easily by using WordPress Forums Plugins. Community growth greatly depends on ongoing ...
5 Annoying WordPress PluginsUsually I attempt to share useful WordPress information but today, I thought we could have some fun with 5 of the most annoying WordPress ...
New releases for jQuery and WordpressThe jQuery Database plugin takes your HTML tables and allows you to write a query against them similar to MS- or mySQL. I haven’t had ...
Be the first ... |Add your comment.
Your Comment ...
Name (required)
Email (required, hidden)
Website
