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:
- 1. tag.php
- 2. index.php
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:
Archive for the posts tagged with
– posted in
About the archives
Welcome to the archives here at . Have a look around.
- Related tags:
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.
2006年3月16日 at 20:29
I found your article via google,
I got a little problem which is driving me nuts,
I have read through your article and reckon you are my saviour:
whenever I click a tag, such as music for example (http://www.h4x3d.com/tag/music)
my page loads and doesnt show the tag flagged music.
I put the tag.php in my theme folder and my root folder but in both cases it didnt work.
this beast is punishing me for weeks now,
thanks in advance,
2006年3月19日 at 15:04
I’ve been away and busy, hence the late reply.
I had a look at your site. The mistake I was making was not the setting, but just simply the way I wrote the template file: tag.php. So recheck the code of your tag.php. Or, make a copy of archive.php and rename it to tag.php.
Try that, and let me know if it still doesn’t work.
2006年3月24日 at 02:21
a late reply is better than no reply at all 🙂
thanks a bunch anyhow!
I have no idea what I am getting wrong, but I did as you advised and still nothing happens.
I have a tag.php (basicly archives.php) in my /root/ and in my theme folder.
It somehow doesnt work.
Maybe it´s gotta do with .htaccess and permalinks?
2006年3月25日 at 00:45
You only need tag.php in the theme folder.
I am not really familiar with hacking .htaccess and permalinks. I am not sure what kind of error is a indication of that it is .htaccess related. I see that you are using fancy urls, so I am guessing its not .htaccess realted, but I am not sure.
If the problem is not template related, I have to say that its out of my hand, as I am not programming or server guru 🙁
So if you haven’t yet, head over to UTW’s support form, and see if they can help you.
2006年3月25日 at 16:37
thanks mate will do,
much thanks for your advise and best regards,
I will report back once I have fixed it,
2006年4月2日 at 09:10
Thanks so much for your code. I messed up with so many 404-pages until now! People, be sure not to copy the “pre”-tag from the code to your tap.php.
2006年7月8日 at 19:34
toru, is this page slightly “screwed” up? or is that how it is supposed to be? I liked your prior design to this one. anyhow, keep it up, jez!
2006年7月8日 at 23:03
Hey jez, it wasn’t slightly “screwed” up, it was completely “screwed” up! Its because, I now use different plugin for displaying the code snippets, and how its used is different. I didn’t bother to edit this entry for that change. But now I fixed it.
You mean the prior desin as the black one? The layout of the new design is slightly based on that. I will keep fiddling with the details.