Another Run at WordPress <title> Tags

calendar Posted on January 18, 2007   comments 3 Comments

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?

tags Tags: , , , ,

Related Posts Possibly Related Posts

Comments

3 Responses to “Another Run at WordPress <title> Tags”

  1. The Zero Boss on January 18th, 2007 8:31 pm

    Very cool. :) Glad the writeup was helpful!

  2. Chris on January 18th, 2007 9:20 pm

    Thanks man - your article was just the ticket to nudge me along!

  3. » pingback » Yet Another New Look » Solo Technology on May 5th, 2007 11:02 pm

Leave a Reply




Have you read the Comments section on the Disclaimer page?

About

Wandering the Internet, looking at all things bright and shiny. Playing with many, writing about some. More …

Recent Posts

Recent Comments: