Create Clean Title Tag for your WordPress Posts



One of the easiest things you can do is define a clear and simple Title tag for all of your Blog Posts and implementing this in your Header.php file. You will often want to override whatever theme default is being set and in many cases by doing this manually you can avoid the overhead of adding another WordPress plug-in that just adds a custom title tag to your blog post. The ‘Title’ tag is the name that your post displays at the top of the browser when the page is visited, and it also is the “Title” of your article that gets picked up and displayed on Google Search engines:

Typically what you want to do is keep your title clean, any blog themes will have || or >> characters as part of the Title tag which don’t translate well and provide no SEO value, they also interfere with your ability to submit your articles cleanly to sites like BlogEngage, Digg or other directories.

I decided to make my own custom Title tag in my blogs and simply use this line of text inserted into my Header.php after the <head> tag:

<title><?php if ( is_single() ) { echo wp_title(“”,true) . ‘ on ‘ . get_bloginfo(‘name’); } else { echo get_bloginfo(‘name’) . ‘ for ‘ . get_bloginfo(‘description’); } ?></title>

What the above code will do is set your Title tag to just be your “post title” if it is  apost, and if it is  your homepage or archive, search or any other page, it will use your blog name for <blog description>

so for DragonBlogger.com you can see my title for my homepage becomes:
Dragon Blogger for Blogging Tips, Technology news, with Movie Reviews and Entertainment posts mixed in for fun.

and my posts themselves have a title of just the “post name” on “Dragon Blogger”

I like having my blog name/handle in the title of all posts so users who search for articles can see my identity and handle in the title, or else they may not easily know which site the article is located on.  This is a matter of preference but in my opinion you should make it as easy as possible to identify which site or who the article is attributed to on Google search results.

This code is easily modified and you can use it for just about any blog theme, just remember to backup your existing header.php first and then replace your original <title> tag in your theme with this tag above.  You can tailor it if you need to, but this is a good alternative to using a WordPress plug-in.

-Dragon Blogger

Justin Germino
Working in the IT Industry for over 17 years starting with OS, Networking and then moving into web based technologies including authentication and online security. Dragon Blogger has unique insights and opinions to how the internet and web technology works. An Avid movie fan, video game fan and fan of trying anything and everything new.
Justin Germino

@dragonblogger

Technology, Gaming and Wordpress blogger who runs gadget giveaways, helps others with blogging tips, monetization, earning and more!
Sharpshooter5000X started followin' on #Twitch - https://t.co/kMYSf88xM4 - #HYPE #Friends - 2 hours ago
Justin Germino
Justin Germino
Instagram