PHP Magic Book – Free PHP Scripts, Tutorials and Downloads, PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips

Customizing WordPress Tags Cloud – A Guide

tags-cloud

If you have already used some social networking website or you are a blogger then you definitely know what the tags are. WordPress offers Tags Cloud which can be customized the way you use it at your blog. By default WP Tag Cloud will generate limited number of tags in alphabetical order. Custom templates for tags can be made which means that you can have a full page of tags as you want it. Look at the 404 page of phpmagicbook. I have used tags to give the users some more options to browse if he gets distracted by ‘page not found error’. I was thinking to give my users all tags option to click at any one. Okay now this is just one use. You can have your own customized tags page which can contain just tags and nothing more. We explore some ways about how we can customize tags/tags template/tags page at our WordPress blog.

Default Tags Cloud

Paste the following code anywhere in your blog theme’s template files (e.g. 404 page, single post page etc.) to see default tags cloud in action:

<?php
if (function_exists('wp_tag_cloud'))
wp_tag_cloud();
?>

Display All Tags

Following code will give you all the WordPress tags which you have used in your blog.

<?php
if (function_exists('wp_tag_cloud'))
wp_tag_cloud('number=0');
?>

Define Custom Font Size in Tags Cloud

Following code will determine the smallest and largest size in your tags cloud.

<?php
if (function_exists('wp_tag_cloud'))
wp_tag_cloud('smallest=8&largest=22');
?>

Random Ordered Tags Cloud

Following code will generate random tags cloud which will not be in alphabetical order.

<?php
if (function_exists('wp_tag_cloud'))
wp_tag_cloud('order=RAND');
?>

Tags Cloud Limited in Size & Ordered by Number of Posts

Following code will generate custom font sized tags cloud ordered by post frequency under a specific tag.

<?php
if (function_exists('wp_tag_cloud'))
wp_tag_cloud('smallest=8&largest=22&number=30&orderby=count');
?>

Tags Cloud Format

You can format Tags Cloud in flat (Default) format – separated by whitespace, list format and array format by using following method:

<?php
if (function_exists('wp_tag_cloud'))
wp_tag_cloud('format=list' );
?>

And there is ASC (Default), DESC and RAND order for Tags display order.
Exclude and Include option to exclude and include tags and more…

Mixing Things Up

And finally with a bit of a magic you can add the bits and bytes into a full story of customized Tags Cloud for your own blog. A possible combination of code and example:

<?php
if (function_exists('wp_tag_cloud'))
wp_tag_cloud('smallest=8&largest=22&unit=pt&number=50&format=flat&orderby=name&order=ASC&exclude=garbagetag&include=mytag' );
?>

Example: Browse Ajax Rain’s tags page to view the full tags option in action.

ajax-rain-tags-cloud

WordPress has got complete guide about how you can create custom tags cloud page template or how you can customize tags cloud at your blog in a number of ways. Give it a try.

template-tags-resources

Have your say! Do you like to customize Tags Cloud at your blog or this is not a necessary part?

  • Share/Bookmark
Tags: , , , ,
Posted in: Hacks, WordPress
Post's RSS » RSS 2.0
Post's Comments RSS » RSS 2.0

Related Posts




12 Responses to “Customizing WordPress Tags Cloud – A Guide”

  1. Feb 15, 2009
    Sarfraz Says:

    A very very helpful and easy post about customizing tags cloud for wordpress. Thanks a ton.

  2. Feb 15, 2009
    Kamran Says:

    Nice post. I am ready to start my new blog and creating theme myself. Want to customize it all for my needs. Can you help?

  3. May 2, 2009
    inspirate Says:

    thanks,,,i need to create my blog and look beautiful…

  1. 9 Trackback(s)

  2. Feb 15, 2009: Posts about SEO as of February 14, 2009 | Ebusiness Blog
  3. Feb 17, 2009: Redirect Ugly Permalink to Postname - All web resource stuff
  4. Feb 19, 2009: How to Include Specific File In WordPress Blog Template - All web resource stuff
  5. Feb 19, 2009: How To Display Some Content at Just Home Page and Single Post of Blog - All web resource stuff
  6. Feb 19, 2009: Display RSS Feed From Any Blog on Your WordPress Blog - All web resource stuff
  7. Feb 19, 2009: Provide RSS Feed for Each Post and Comment at Your WordPress Blog - All web resource stuff
  8. Feb 19, 2009: Remove Ads for Registered Users or Admin on WordPress Blog - All web resource stuff
  9. Feb 19, 2009: Remove Comments Section From Your WordPress Blog - All web resource stuff
  10. Feb 19, 2009: Insert Adsense After the First Post in Your WordPress Blog - All web resource stuff

Post a Comment

  Subscribe Via RSS
  Subscribe Via Email