Added the Tag page - How To
Posted on February 12, 2006
6 Comments
I've been using a WordPress plugin titled "Ultimate Tag Warrior" (UTW) for a month or so and been pretty happy with it. It integrates nicely and helps me tag my posts and work with technorati and other similar services that are tag driven.
One of the "neato" features it offers is the ability to build a tag cloud. Easy to do too -- just add a line of php code to the WP template and you're good to go. Until this morning, I had a tag cloud showing up at the bottom of most blog pages. I decided, however, that it was taking on a life of its own and perhaps was just too large to be plopped down at the bottom of most pages.
Meanwhile, BlinkList offered a way for bloggers to build tag clouds of their bookmarks. (I'm not entirely positive that link will work... if not, just click "Help" at the bottom of the blinklist pages and choose the cloud option from under "Blog Tools".) Just a snippet of javascript and you get a pretty cloud in return.
I never was able to get anything generated out TagCloud.com's service. *sigh*
So I thought to myself, "Self, (as that's what I call myself) wouldn't it make sense to stop wedging these clouds into pages and just give them a page of their own?" And so, "The Tags" was born.
[updated:] I should explain why I wrote the rest of this I think? Since UTW's tag cloud is an actual php function call, I can't just plop it anywhere -- actually had to think it through a bit. BlinkLists's cloud comes via javascript, so I can be much more flexible with where I plot it. [/updated]
Now, UTW comes with a nice little help file that the WP admin is easily able to reference while in the configuration section (Options -> Tags). And, one of the sections in said file addresses adding a "Tag" page to the blog. And it is a nice start:
- Create a file named tags.php in your theme folder.
- At the top of it, include this text: <?php /* Template Name: Tag Archive */ ?>
- Tag Archive will now display in the list of page templates on the 'edit page' page.
- Next, go to Write -> Write Page, give the new page a title; then select 'Tag Archive' from the list of page templates, in the Page Options section. Click the 'Create New Page' button.
- Marvel at your greatness
- Add some stuff to the tags.php file, so that it does something useful
So, I went to my theme directory, and made a copy of "page.php" and called it "tags.php". I used page.php as I wanted all my "normal" theme elements to be part of the page. Used my editor of choice and changed the top line of tags.php as mentioned in step 2. But wait, where's my tag cloud? I didn't see that mentioned in the steps from the help file. I didn't experiment much here... I just decided to add my own.
Editing tags.php again, I modified the stuff between the <div id="content"> tags to look like this:
-
<div id="page">
-
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
-
<h1><?php the_title(); ?></h1>
-
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
-
<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
-
<?php endwhile; endif; ?>
-
<?php UTW_ShowWeightedTagSetAlphabetical("coloredsizedtagcloud") ?>
-
</div>
-
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
Ok, now if add a new WP Page, and select "Tag Archive" from the templates I get a cloud. Don't even have to add content to the page -- beyond a title, of course. I just have to remember that any content I add is going to be above the tag cloud. If, for some reason, I ever want the cloud to be on top, I'll need to create a tags_top.php and move that UTW_ShowWeightedTagSetAlphabetical() function call to the top of the div.
Adding the blink list bits was pretty straightforward, but the caveat is that you can't use the WYSIWIG editor to paste in <script> content. So, first I made sure to disable that editor, then pasted in my custom little bit of javascript obtained from BlinkList:
-
<script type="text/javascript"
-
src="http://www.blinklist.com/HandySolo/cloud.js&logo=0
-
&title=Most popular BlinkList ags&fontsize=10
-
&cloudsize=100 &fontcolor=23598C
-
&colorbegin=409FCF &colorend=FF6600">
-
</script>
(I added some line breaks in there just for readability...)
And voila, a tag cloud page is born.
Tags: BlinkList, blog, tagcloud, tagcloud.com, tagging, tags, technorati, ultimate-tag-warrior, WordPress
Possibly Related Posts
Comments
6 Responses to “Added the Tag page - How To”
Leave a Reply



You might be interested in this plugin http://www.nickbouton.com/delicious-tag-cloud
to add your delicious (assuming you use them) tag cloud to your tags page also. you can see it in use on my links page.
(No affaliation with the plugin, just one I use).
Why does this page look so all over the place when viewed in Mozilla 1.7.11 ?
I just found out why. It doesn’t validate (http://validator.w3.org) so the css is not working properly
Ugh, it was horribly messed up. Still not perfect, but it should display a bit more properly now.
thanx..