One of the plugin which I was very interested in using is the Ultimate Tag Warrior (UTW). It is an excellent and very powerfull plugin which lets you to incorporate the trendy “tagging” in to WordPress. I did actually look around for other plugins that were a bit more simple, but in the end, I decided to go with UTW. Simply, I felt that as I am new to the WordPress, and not a PHP and MySql expert, I will go with the popular one which will likely to have more documents about it on the web. Just incase I bump into a problem. You could argue that complex and data base fiddling plugin like UTW, is not really something for novice to tackle, but I was willing to take that risk. If something really bad happens … that will teach me that taking backups often is a very very important thing to do!
It was all so well. Installation was very easy, just like any other WordPress plugins. After I switched off “Automatically add categories as tags” on the Tag Options pannel, I added few UTW tags there and there in the theme files. You can see it in the Archives page, Monthly Archive page, and single post page. But something I struggled was, how to display an archive page for a particular tag. A local tag link. So when a visitor clicks “wordpress” tag, it will show the list of all post on my site which are tagged with “wordpress” tag.
I have to say that I, as a relative novice, felt it was the most unhelpfull section of the both local and web help. Mainly because there were no example template, and rather short mention of is_tag() were confusing. Also, do I have to use tag.php, or can I use archive.php ?
The solution was very simple. This is how I did it, which may be useful for someone outhere who are stuck, like I was.
So how is it done ?
First of all, the template hierarchy for showing /tag/sometag is:
Basically, UTW will look for tag.php first, then if doesn’t exist, index.php. Are happy with UTW using index.php, and generating the result page in the main index page fashion ? If you are not, then read on.
I nearly forgot to say; I think using tag.php only works with using fancy URLs for tags. If you are not using fancy URLs, UTW will always use index.php, I think.
You need to edit, so that tag.php is a template to how /tag/sometag page is shown. I wanted to generate the page to look like an archive page, so I made a copy of archive.php, and renamed it to tag.php. A required thing within tag.php is to conatain a WordPress Loop. No need for UTW template tags. I use Hemingway theme, and deleted unwanted stuff within the WordPress loop. Thats things like “if is monthly archive…” and “if is daily archive…”. The final tag.php for my Hemingway look something like:
[php]
Archive for the posts tagged with
Not Found
About the archives
Welcome to the archives here at . Have a look around.
- Related tags:
[/php]
You can see the WordPress loop in the div class=primary.
You should edit your tag.php accordingly to how you want it to look. I will probably look different, if you are working on the deferent theme, but importat thing is that it have to contain The Loop. Throw this tag.php file into the theme folder which you use. This should work. No UTW template tag, and nothing special about it. Just an ordinary WordPress template file, with WordPress loop in it.