<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Orzeszek Blog &#187; tag cloud</title>
	<atom:link href="http://www.orzeszek.org/blog/tag/tag-cloud/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.orzeszek.org/blog</link>
	<description>An inchoate upside-down perspective</description>
	<lastBuildDate>Sun, 25 Jul 2010 03:21:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Change the Tag Cloud Font Size in WordPress 2.8</title>
		<link>http://www.orzeszek.org/blog/2009/06/11/change-the-tag-cloud-font-size-in-wordpress-2-8/</link>
		<comments>http://www.orzeszek.org/blog/2009/06/11/change-the-tag-cloud-font-size-in-wordpress-2-8/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 14:14:39 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[tag cloud]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress plugins]]></category>

		<guid isPermaLink="false">http://www.orzeszek.org/blog/?p=688</guid>
		<description><![CDATA[One of the annoyances about the default tag cloud widget in WordPress is that there is no easy way to change the minimum and maximum font size that the widget uses. While the recent release of WordPress 2.8 doesn’t add any UI to change those sizes, it’s now easier to change them than before.]]></description>
			<content:encoded><![CDATA[<p></p><p><span class="drop_cap">O</span>ne of the annoyances about the default tag cloud widget in WordPress is that there is no easy way to change the minimum and maximum font size that the widget uses. While the <a href="http://wordpress.org/development/2009/06/wordpress-28/">recent release of WordPress 2.8</a> doesn’t add any UI to change those sizes, it’s now easier to change them than before.</p>
<p><img src="http://www.orzeszek.org/blog/wp-content/uploads/2009/06/tag-clouds.png" alt="WordPress tag clouds" title="WordPress tag clouds" width="501" height="262" class="aligncenter size-full wp-image-694 orz-img-no-border" /></p>
<p>WordPress 2.8 adds a new <strong>widget_tag_cloud_args</strong> <a href="http://codex.wordpress.org/Plugin_API#Filters">filter</a>, which you can use to override the default arguments that are passed to the <strong>wp_tag_cloud</strong> function. The filter provides a keyed array, where the <strong>smallest</strong>, <strong>largest</strong>, and <strong>unit</strong> keys represent the smallest font size, the largest font size, and the unit (‘pt’, ‘em’, ‘px’, etc) used by the default tag cloud widget.</p>
<p>You can change the minimum and maximum font size that the default tag cloud widget uses in WordPress 2.8 by <a href="http://codex.wordpress.org/Writing_a_Plugin">creating a new plugin</a> that hooks that filter as explained below.</p>
<p><span id="more-688"></span></p>
<p>Create a new text file called <strong>orz-tag-cloud.php</strong>. Copy and paste the following code into that text file, changing the relevant values (shown in bold) as desired, and save it.</p>
<div class="orz-codeblock">
<p><code>&lt;?php<br />
/*<br />
Plugin Name: Orzeszek Tag Cloud<br />
Plugin URI: http://www.orzeszek.org/blog/<br />
Version: 1.1<br />
Author: Orzeszek<br />
Author URI: http://www.orzeszek.org/blog/<br />
Description: Changes the font sizes used by the tag cloud widget.<br />
*/</code></p>
<p><code>function orz_tag_cloud_filter($args = array()) {<br />
&nbsp;&nbsp;&nbsp;$args['smallest'] = <strong>8</strong>;<br />
&nbsp;&nbsp;&nbsp;$args['largest'] = <strong>12</strong>;<br />
&nbsp;&nbsp;&nbsp;$args['unit'] = '<strong>pt</strong>';<br />
&nbsp;&nbsp;&nbsp;return $args;<br />
}</code></p>
<p><code>add_filter('widget_tag_cloud_args', 'orz_tag_cloud_filter', 90);<br />
?&gt;</code></p>
</div>
<p>Create a new directory called <strong>orz-tag-cloud</strong> in your <strong>wp-content/plugins</strong> directory, and upload <strong>orz-tag-cloud.php</strong> to the new directory. Finally, activate the plugin by logging into WordPress as an administrator, selecting <strong>Plugins</strong> from the menu, and selecting <strong>Activate</strong> for the <strong>Orzeszek Tag Cloud</strong> plugin.</p>
<p class="note">Make sure that the very first characters in <strong>orz-tag-cloud.php</strong> are <strong>&lt;?</strong> and that the very last characters are <strong>?&gt;</strong>. If they’re not (for instance, if you have a space after <strong>?&gt;</strong>), you may get a ‘Warning: Cannot modify header information – headers already sent…’ message. <a href="http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/">More info.</a></p>
<p><strong>Update 1:</strong> I updated the plugin to be even simpler and more streamlined. I had originally adapted the plugin from a more complex plugin that provides certain functionality specific to my blog. The original class structure was unnecessary for this simple plugin, however.</p>
<p><strong>Update 2:</strong> I updated the instructions to place the <strong>orz-tag-cloud.php</strong> in its own folder to minimise the potential for conflicts with other plugins.</p>
<p><strong>Update 3:</strong> Added a note indicating the cause of the ‘Warning: Cannot modify header information – headers already sent…’ message, and how to avoid it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.orzeszek.org/blog/2009/06/11/change-the-tag-cloud-font-size-in-wordpress-2-8/feed/</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
	</channel>
</rss>
