How To Make A Tag Cloud Page on WordPress

Recently I wanted to make a tag cloud into a page and I went exploring for a couple of options.  I found several choices and try each of them, but each were not each to use and implement or required more plug-ins.  I didn’t want to install any additional plug-ins, but still wanted a to have one easy code to copy and paste into my page template that would generate a tag cloud on a page.  The following code is my own creation and seems to work great for WordPress and makes a generated tag cloud page without needing to know any additional code, make any other templates, or install any other plug-ins.

How To Make A Tag Cloud Page on WordPress:  No Additional plug-ins, templates, or code knowledge required.

Install:

1. Copy the following code:

<?php if (is_page(‘Tags’)) { $tag = wp_tag_cloud(‘smallest=8&largest=22′); echo($tag); } ?>

2. Paste this code into your page template inside the content <div> tags.  To locate this, you click on the main design tab of the WordPress Admin, then click on theme editor.  There will be a file selection to the right that says page template, or page.php.  This is the file you want to put it in if you want to make it a page.  (If you want to make it a post it is much easier and doesn’t require the say code.  I’ll make another post about that code.)

3. Click to save the file.

4. Make a new page called ‘Tags’ and leave the content blank, or put a headline or tag directory description if you want for SEO purposes.  Publish this page and you’ll be done.

That’s It, Your Done!

How it works and what is going on? There are several parts to this and I’ll explain why I used each piece.

  • I wanted it to be a page, but if you put the normal tag cloud on the page template it will show up on every page and not just the one page.  The first part of the php states if the page is called ‘tags’ then post the next part of the php.  I’ve seen other solutions that also said to create a new page template called tag cloud, upload that and put the normal tag cloud on it, then go make a page called tags and tell it to use the tag template.  This require making a new page, uploading via ftp, and other webmaster features that not everyone may have access or knowledge for.
  • The second part of the code makes a tag to be used in the php call.  The reason for this is that the normal WordPress tag cloud php generator cannot be placed directly inside of the php if tag, so I had to make a tag that calls the tag cloud generator and tell the if tag to echo or display that tag.  This solution produces a tag cloud that is only visible on the page that is set in the code.  In this case we call for the page as ‘Tags’, so as long as the page is called tags the content will show up, if not called Tags, then nothing will show up.
  • There was one option that require only a similar type of code, where I got the original idea from, but it called to a plug-in that needed to be installed in order to make it work. I didn’t want to install the extra plug-in so I went to work trying to figure out to make it do it without the plug-in.

This solution presented the option and could be used WordPress for making a tag cloud page.  You will not need to make a new page or template, upload any new files, install any new plug-ins, or any further code knowledge.  I hope this helps other WordPress users who want to make a tag cloud page.

Modifications:

1. You can use any page title you want, but keep it to one word, and make sure to change the if tag to ‘yourpagetitle’ instead of ‘Tags’.  I use a page called ‘Sports’ on another site and the page title is also Sports.

2. You can modify the size and some of other parameters inside of the tag cloud and how it displays.

For comment order instead of name order you can use this code:

'smallest=8&largest=22&number=30&orderby=count'

You can view other options for tag clouds at the WordPress Codex.

6 thoughts on “How To Make A Tag Cloud Page on WordPress”

  1. Thanks a lot, I had been trying to set up a tag cloud page for a while and didn’t find a suitable way to do it. I don’t have such an easy acces to the ftp server so I didn’t want to upload a page, and yours is the first solution I can use without plugins and without uploading files. I tried it and it works perfectly!

    Just a small question, if it’s OK: I want to order my tags with the “count” command, but I would rather have them the other way around: right now, it orders them from less to most frequent tags, and I would like to have the most frequent tags first. Do you know how to change this?

    Thanks a lot :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>