LATEST >>

Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » WordPress / WordPress Snippets » SE Optimized WordPress Title Tag For Newbie Blogger

SE Optimized WordPress Title Tag For Newbie Blogger

SE-Optimized-WordPress-Title-Tag
WordPress is a full features CMS that is also open source means that you can do more whatever you want from it. Now for SEO, everyone knows the <title> </title> tags are the most important part of SEO and your wrong title tag can make your blog down. So you have to write the perfect dynamic title tag in your WordPress theme so that it can pick the right text for the right page.

Now if you have ever views your WordPress theme codes then you have expirenced that your theme contain <?php wp_title() ?> in the <title> </title> place so its ok as its WordPress default title tag. Now Is this ok? No, you have to make it perfect. You can view the WordPress Reference of (wp_title) at WordPress codex page to learn more about it.

Here we will discuss about the best WordPress title tags. As you know that WordPress have many different pages that should contain different titles. As a short info, the below are the basic pages of a WordPress blog…

  • The Home page
  • Individual pages
  • Single post views
  • Archived post views
  • Date-based archives
  • Category archives
  • Author archives
  • 404 error pages
  • Search results
  • Tag archives

WordPress theme contain <?php wp_title() ?> as there default title tag. WordPress default title tag is <?php wp_title() ?> shows the below titles on these pages…

  • The Home page — no output
  • Individual pages — page title
  • Single post views — post title
  • Archived post views — no output
  • Date-based archives — year and/or month
  • Category archives — category title
  • Author archives — public username
  • 404 error pages — no output
  • Search results — no output
  • Tag archives — tag name

Now if you want to best title tags that will be highly SEO optimized then here we will recommend you to replace <?php wp_title() ?> with the below one.

<title>
<?php // WordPress custom title script

// is the current page a tag archive page?
if (function_exists('is_tag') && is_tag()) { 

	// if so, display this custom title
	echo 'Tag Archive for &quot;'.$tag.'&quot; - '; 

// or, is the page an archive page?
} elseif (is_archive()) { 

	// if so, display this custom title
	wp_title(''); echo ' Archive - '; 

// or, is the page a search page?
} elseif (is_search()) { 

	// if so, display this custom title
	echo 'Search for &quot;'.wp_specialchars($s).'&quot; - '; 

// or, is the page a single post or a literal page?
} elseif (!(is_404()) && (is_single()) || (is_page())) { 

	// if so, display this custom title
	wp_title(''); echo ' - '; 

// or, is the page an error page?
} elseif (is_404()) {

	// yep, you guessed it
	echo 'Not Found - '; 

}
// finally, display the blog name for all page types
bloginfo('name'); 

?>
</title>

Now the above title tag will display the below result on your mentioned pages of your WordPress blog.

// Home page:
Blog Name

// Tag archives:
Tag Archive for "tag name" - Blog Name

// Search results:
Search for "search string" - Blog Name

// 404 error pages:
Not Found - Blog Name

// Individual pages and single posts:
Post or Page Title - Blog Name

// Archived post, date, category, and author pages:
Date, Category, or Author - Blog Name

Theme Files Editing Warning:

Keep in mind that every code that you will add in your themes files will be removed when you will change the theme. So after changing your theme, you have to follow this article again and you will get everything back same as it is now.

Last Words:

This is what we have and shared in easy steps for newbies so that they can easily know how it works. Stay with us because we are going to share a whole guide step by step about WordPress and make it easy for you. If you liked it then share it and be with us to get next tutorial. If you have any problem then feel free to ask us. We will help you with what we can or have.

You Like It, Please Share This Recipe With Your Friends Using...

Be the first to write a comment.

Leave a Reply

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