Tag Cloud Shortcode

You can use the following WordPress shortcode to output a tag cloud on posts, pages, HTML Widgets, Thesis Text Boxes, or any other content area that can process shortcodes.

Note: These instructions assume you are using a PHP customization class to organize your custom code.

public function __construct() {
	add_action('template_redirect', array($this, 'front_end')); // Shown for context
	/* Hooks and filters that need to fire early go here */
	add_shortcode('custom_tag_cloud', array($this, 'tag_cloud'));
}

public function tag_cloud($args = array()) {
	if (is_array($args))
		extract($args);
	return
		wp_tag_cloud(array(
			'echo' => false,
			'number' => 0,
			'smallest' => 14,
			'largest' => 37,
			'unit' => 'px'));
}

With your custom code in place, you can now reference this shortcode in a content area:

[custom_tag_cloud]

Easy!