Another Run at WordPress <title> Tags

Had an interesting question pop up at the WordPress support forums today. The person was wondering how to incorporate tag names (from the Ultimate Tag Warrior plugin) into page titles.

When I saw the question, I recalled stumbling over the is_tag() function once before. A quick web search turned up an article at The Zero Boss that looked pretty helpful.

However, I didn't quite like his title style (nor did I want to retitle all of my existing indexed pages!) so I adapted his style into my style and ended up with this:

PHP:
  1. <title>
  2.     <?php if (is_tag()) { ?>
  3.         <?php echo 'Articles tagged with: '; ?>
  4.         <?php UTW_ShowCurrentTagSet('tagsettextonly'); ?>
  5.         <?php echo ' &raquo; '; ?>
  6.         <?php bloginfo('name'); ?>
  7.     <?php } else { ?>
  8.         <?php wp_title(''); ?>
  9.         <?php if(wp_title('', false)) { echo ' &raquo; '; } ?>
  10.         <?php bloginfo('name'); ?>
  11.     <?php } ?>
  12. </title>

Clicking on one of my tags will get a page titled "Articles tagged with: tagName » Solo Technology". Before, the title for those pages was simply "Solo Technology", so when looking at analytics I had to look deeper to figure out when tag pages were being hit.

Nifty?

Possibly Related posts:

  1. Added the Tag page – How To
  2. WordPress 2.1
  3. BlinkList Space for WordPress links
  4. WordPress Community
  5. The Zeitgeist – And How-To


3 comments to Another Run at WordPress <title> Tags

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>