<?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>Themocracy WordPress Themes &#187; Lisa</title>
	<atom:link href="http://themocracy.com/author/lisa/feed/" rel="self" type="application/rss+xml" />
	<link>http://themocracy.com</link>
	<description>WordPress Theme Design</description>
	<lastBuildDate>Mon, 26 Jul 2010 06:18:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using JSON with WordPress</title>
		<link>http://themocracy.com/2010/02/json-wordpress/</link>
		<comments>http://themocracy.com/2010/02/json-wordpress/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:16:33 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=258</guid>
		<description><![CDATA[With the popularity of jQuery, AJAX, and client-side programming operations in general, there's more use made of JSON as a format for getting data backwards and forwards. 

For example, the Twitter API offers data as JSON  - and more manageably than accessing their RSS XML feeds for user timelines.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fjson-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fjson-wordpress%2F" height="61" width="51" /></a></div><p><img src="http://themocracy.com/wp-content/uploads/2010/02/json.gif" alt="json with wordpress" title="json-wordpress" width="128" height="128" class="alignright size-full wp-image-259" />With the popularity of jQuery, AJAX, and client-side programming operations in general, there&#8217;s more use made of JSON as a format for getting data backwards and forwards. </p>
<p>For example, the Twitter API offers data as JSON  &#8211; and more manageably than accessing their RSS XML feeds for user timelines etc.</p>
<pre>http://twitter.com/status/user_timeline/USERNAME.json?count=10 </pre>
<p>The issue is how to make use of JSON-encoded information in the WordPress environment &#8211; much of what is available is only recently available, so some care has to be taken about how it&#8217;s used.</p>
<h3>1. Native PHP functions</h3>
<p><strong>json_encode()</strong> and <strong>json_decode()</strong> make life very simple &#8211; but these functions are only available in PHP >= 5.2.0 and WordPress is still designed to run on significantly older versions of PHP than this. Alternatives would have to be supplied if you were thinking about releasing a plugin. There are custom-written functions to reproduce these in PHP4, see for example user contributions to <a href="http://php.net/manual/en/function.json-encode.php">json_encode</a>. These are often not 100% perfect, but one may well do all that you require&#8230;</p>
<h3>2. JSON2</h3>
<p>If you&#8217;re happy to do the work in jQuery/javaScript, WordPress 2.9 comes with JSON2 bundled, registered and ready to go&#8230;</p>
<pre class="brush: php">
add_action(&#039;wp_print_scripts&#039;,&#039;load_json_parser&#039;);

function load_json_parser(){

	if (is_admin()) return; // probably don&#039;t want this on admin pages

	wp_enqueue_script(&#039;json2&#039;);

}
</pre>
<p>No need any more to play around with eval in the javaScript, but again, this is a WordPress >= 2.9 thing&#8230;. </p>
<h3>3. Borrowing the Text Editor</h3>
<p>Lastly, there is one more, slightly unofficial, dodge that can be used. WordPress makes use of TinyMCE as its rich text editor and this comes with the its own JSON parser. Results may not be completely predictable. </p>
<pre class="brush: php">
require_once(ABSPATH.&quot;/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php&quot;);

$jsObj = new Moxiecode_JSON();

// encodes the supplied array to JSON format
$json = $jsObj-&gt;encode(array(&quot;key1&quot;=&gt;&quot;value1&quot;,&quot;key2&quot;=&gt;&quot;value2&quot;));

//decodes supplied JSON to a PHP array
$json_array = $jsObj-&gt;decode($json);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/json-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Separate Pingbacks from User Comments</title>
		<link>http://themocracy.com/2010/02/separate-pingbacks-user-comments/</link>
		<comments>http://themocracy.com/2010/02/separate-pingbacks-user-comments/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 07:29:21 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=256</guid>
		<description><![CDATA[People have predicted their death for a long time, but pingbacks/trackbacks (and displaying them) are still firmly with us - there is a certain vanity involved...

They do give an indication of related content, other sites in your niche (and just how many automated spam sites there are out there ) etc. At the same time, they break up the flow of user comments and even with threaded comments can make it difficult for visitors to follow the discussion. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fseparate-pingbacks-user-comments%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fseparate-pingbacks-user-comments%2F" height="61" width="51" /></a></div><p><img class="alignright size-full wp-image-240" title="wordpress comments" src="http://themocracy.com/wp-content/uploads/2010/02/comments.gif" alt="wordpress comments" width="128" height="128" />People have predicted their death for a long time, but pingbacks/trackbacks (and displaying them) are still firmly with us &#8211; there is a certain vanity involved&#8230;</p>
<p>They do give an indication of related content, other sites in your niche (and just how many automated spam sites there are out there ) etc. At the same time, they break up the flow of user comments and even with threaded comments can make it difficult for visitors to follow the discussion.<br />
<span id="more-256"></span><br />
So it&#8217;s reasonable to separate out pingbacks and perhaps not include their digest content, just the title and a link. The method has changed for WordPress 2.7 upwards, with the arrival of threaded comments and their integration into the core code.</p>
<p>The frist step is to adjust the call to the comments template in <strong>single.php</strong> or where ever you&#8217;re hoping to display the comments&#8230; Replace:</p>
<pre class="brush: php">
&lt;?php comments_template(); ?&gt;
</pre>
<p>with</p>
<pre class="brush: php">
&lt;?php comments_template(&#039;&#039;, true); ?&gt;
</pre>
<p>The &#8220;true&#8221; flag gives access to an array $comments_by_type &#8211; as the name might even suggest, a record of the numbers of each type of comment for that post.</p>
<p>Your theme will (should) have something like this code in it &#8211; most likely in <strong>comments.php</strong> but possibly as a separate comments template function in <strong>functions.php</strong> or elsewhere &#8211; the important thing is to locate <strong>comments_number()</strong> and <strong>wp_list_comments()</strong></p>
<pre class="brush: php">
&lt;h3 id=&quot;comments&quot;&gt;&lt;?php comments_number(&#039;No Responses&#039;, &#039;One Response&#039;, &#039;% Responses&#039; );?&gt; to &amp;#8220;&lt;?php the_title(); ?&gt;&amp;#8221;&lt;/h3&gt;

&lt;ol class=&quot;commentlist&quot;&gt;
&lt;?php wp_list_comments(); ?&gt;
&lt;/ol&gt;
</pre>
<p>Replace it with this:</p>
<pre class="brush: php">

&lt;?php if ( !empty($comments_by_type[&#039;comment&#039;]) ) : ?&gt;

&lt;h3 id=&quot;comments&quot;&gt;&lt;?php comments_number(&#039;No Responses&#039;, &#039;One Response&#039;, &#039;% Responses&#039; );?&gt; to &amp;#8220;&lt;?php the_title(); ?&gt;&amp;#8221;&lt;/h3&gt;

&lt;ol class=&quot;commentlist&quot;&gt;
&lt;?php wp_list_comments(&#039;type=comment&#039;); ?&gt;
&lt;/ol&gt;

&lt;?php endif; ?&gt;

&lt;?php if ( ! empty($comments_by_type[&#039;pings&#039;]) ) : ?&gt;

&lt;h3 id=&quot;pings&quot;&gt;Trackbacks/Pingbacks&lt;/h3&gt;
&lt;ol class=&quot;commentlist&quot;&gt;
&lt;?php wp_list_comments(&#039;type=pings&#039;); ?&gt;
&lt;/ol&gt;

&lt;?php endif; ?&gt;
</pre>
<p>We have 2 lists now, created by wp_list_comments</p>
<p>The other (optional) issue is to recalculate the headline figure of comments &#8211; which is still showing the total of user comments + pings. This is done with the use of the <strong>get_comments_number</strong> filter. Add, in functions.php</p>
<pre class="brush: php">
&lt;?php

add_filter(&#039;get_comments_number&#039;, &#039;comment_count&#039;, 0);
function comment_count( $count ) {
if ( ! is_admin() ) {
global $id;
$comments_by_type = &amp;separate_comments(get_comments(&#039;status=approve&amp;post_id=&#039; . $id));
return count($comments_by_type[&#039;comment&#039;]);
} else {
return $count;
}
}
?&gt;
</pre>
<p>And that should be that &#8211; next step would be to restyle the two lists, with a customized callback function for <strong>wp_list_comments()</strong> &#8211; but that will have to be for another post&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/separate-pingbacks-user-comments/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Expressivo Free WordPress Theme</title>
		<link>http://themocracy.com/2010/02/expressivo-free-wordpress-theme/</link>
		<comments>http://themocracy.com/2010/02/expressivo-free-wordpress-theme/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 13:06:53 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Free]]></category>
		<category><![CDATA[Themes]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=253</guid>
		<description><![CDATA[Expressivo is a free WordPress theme, three-column with two righthand sidebars - going to a single sidebar on single posts and pages. With Cufon embedded fonts for post titles, threaded and paged comments - you can also replace the header completely with your own image.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fexpressivo-free-wordpress-theme%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fexpressivo-free-wordpress-theme%2F" height="61" width="51" /></a></div><p><a href="http://themocracy.com/demo/?t=8"><img src="http://themocracy.com/wp-content/uploads/2010/02/expressivo-wordpress-theme.jpg" alt="expressivo wordpress themes" title="expressivo wordpress theme" width="226" height="181" class="alignright size-full wp-image-254" /></a><strong>Expressivo</strong> is a free WordPress theme, three-column with two righthand sidebars &#8211; going to a single sidebar on single posts and pages. With Cufon embedded fonts for post titles, threaded and paged comments &#8211; you can also replace the header completely with your own image.<br />
<span id="more-253"></span><br />
Version 1.1 has been tested on Firefox 3, Internet Explorer 6 &amp; 7, Google Chrome, Opera 9.</p>
<p><strong>Features</strong><br />
<img src="http://themocracy.com/wp-content/uploads/2010/02/jcolor.jpg" alt="" title="custom link color" width="391" height="169" class="alignright size-full wp-image-255" /></p>
<ul>
<li>Custom link and hover colors</li>
<li>jQuery dropdown menu  for static pages &#8211; exclude pages and configure item order</li>
<li>Add your own header image / logo</li>
<li>Embedded fonts</li>
<li>Translation ready</li>
</ul>
<p><strong>Demo:</strong> <a href="http://themocracy.com/demo/?t=8">Expressivo demo</a></p>
<p><img style="vertical-align:-5px;" class="alignnone size-full wp-image-234" title="theme download" src="http://themocracy.com/wp-content/uploads/2010/02/download_small.gif" alt="theme download" width="25" height="24" /> <strong>Download</strong>: Expressivo WordPress Theme v1.1 &#8211; <a href="http://themocracy.com/extra/themes/expressivo.zip">expressivo.zip</a> Compatible with WP > version2.8</p>
<p>This theme is released under the terms of the GPL licence.</p>
<p>Our free themes are supplied “as is” &#8211; <em>sorry, but we don’t have the resources to offer support for email enquiries or comments about individual installation/customisation</em>. You’re free to use and modify them as you wish, but we would ask you to retain the credit link in the footer.</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/expressivo-free-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A jQuery Slideshow for WordPress 2.9</title>
		<link>http://themocracy.com/2010/02/jquery-slideshow-wordpress/</link>
		<comments>http://themocracy.com/2010/02/jquery-slideshow-wordpress/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 11:03:46 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=248</guid>
		<description><![CDATA[You want a jQuery slideshow for your WordPress blog? - on the front page, or maybe in the sidebar? No real problem, all the javascript is taken of with the help of a jQuery plugin, all we have to do is figure out how to get the post data. 

And to keep things really simple, this is going to use the thumbnail functions in WP 2.9 - no need to mess around with custom fields any more. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fjquery-slideshow-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fjquery-slideshow-wordpress%2F" height="61" width="51" /></a></div><p><img class="alignright size-medium wp-image-249" title="jquery-slideshow" src="http://themocracy.com/wp-content/uploads/2010/02/jquery-slideshow-300x206.gif" alt="jquery slideshow" width="245" height="168" /><strong>You want a jQuery slideshow for your WordPress blog? </strong>- on the front page, or maybe in the sidebar? No real problem, all the javascript is taken of with the help of a jQuery plugin, all we have to do is figure out how to get the post data.</p>
<p>And to keep things really simple, this is going to use the thumbnail functions in WP 2.9 &#8211; no need to mess around with custom fields any more.<br />
<span id="more-248"></span><br />
Firstly, you do have to explicitly declare the new thumbnail system in <strong>functions.php</strong> &#8211; and best to wrap it up in an &#8220;if function exists&#8221; to avoid problems for older WP installs.</p>
<pre class="brush: php">
if (function_exists(&#039;add_theme_support&#039;)) {
add_theme_support( &#039;post-thumbnails&#039; );
add_image_size(&#039;slideshow-image&#039;, 300, 160); // for front page slideshow
}
</pre>
<p>The smart move is to define a &#8220;Featured&#8221; category &#8211; any post in that category will be available for the slideshow, and that&#8217;s the selection taken care of. Create a category &#8211; call it featured, or anything, but make a note of the cat_ID &#8211; mouseover a category on the admin categories page and it&#8217;ll be in the url, something like:</p>
<blockquote><p>http://testblog.com/wp-admin/categories.php?action=edit&#038;<strong>cat_ID=3</strong></p></blockquote>
<p>The ordering will be by date, newest first. (Don&#8217;t forget you can tweak the timestamp of a post if you really want to just to get the order exactly as you want it).</p>
<p>So create a couple of posts in this category and add some thumbnails to them &#8211; since our slideshow is going to be 300px by 160px, make sure they&#8217;re bigger than that. Then, in <strong>home.php</strong>, or <strong>index.php</strong>, where ever you want the slideshow to appear, add:</p>
<pre class="brush: php">
&lt;?php

$featured_category_id = 3;
$number_of_posts = 4;

$args = array(&#039;showposts&#039;=&gt;$number_of_posts, &#039;cat&#039;=&gt;$featured_category_id);

$slideshow_query = new WP_Query($args);

?&gt;
&lt;div id=&quot;slideshow&quot;&gt;
&lt;?php
// let&#039;s keep a record of the post IDs as we go, in case we want to omit these from other post loops/lists on the same page
$duplicates = array();

while ($slideshow_query-&gt;have_posts()) : $slideshow_query-&gt;the_post();

//add the ID to the duplicates array for future reference
$duplicates[] = $id;

//test to see whether there&#039;s a thumbnail associated with the post
if (has_post_thumbnail()) {
?&gt;
&lt;div class=&quot;post-thumbnail&quot;&gt;
&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;
&lt;?php	the_post_thumbnail(&#039;slideshow-image&#039;); ?&gt;
&lt;/a&gt;
&lt;/div&gt;
&lt;?php	}
endwhile;
?&gt;
&lt;/div&gt;  &lt;!-- end of #slideshow --&gt;
</pre>
<p>Next, some javascript. We can use the excellent <a href="http://malsup.com/jquery/cycle/">jQuery Cycle Plugin</a> &#8211; as the package stands currently, we&#8217;ll use <strong>jquery.cycle.all.min.js</strong> &#8211; which allows all the possible transition effects etc. &#8211; in practice, you may well want to use the lighter versions&#8230;</p>
<p>* For a standard production site, always use <strong>min</strong> = minified,  rather than <strong>pack</strong> = packed &#8211; pack may be a smaller filesize, but it doesn&#8217;t run quicker&#8230;.</p>
<p>We need a very quick script to configure and activate the plugin &#8211; so create a new file, <strong>slideshow-activate.js</strong></p>
<pre class="brush: js">
jQuery(document).ready(function($){
$(&#039;#slideshow&#039;).cycle({
fx: &#039;fade&#039; // choose your transition type, ex: fade, scrollUp, shuffle, etc...
});
});
</pre>
<p>Later, there are lots of options here, transition speed, pausing etc. &#8211; consult the <a href="http://malsup.com/jquery/cycle/browser.html">plugin pages</a> for ideas.</p>
<p>We need to get our scripts on the WordPress page, and indicate that they depend on jQuery being loaded &#8211; making use of the WordPress functions <strong>wp_register_script</strong> and <strong>wp_enqueue_script</strong> &#8211; so in <strong>functions.php</strong></p>
<pre class="brush: php">

add_action(&#039;wp&#039;, &#039;js_head_load&#039;);

function js_head_load(){

if(is_admin()) return;  //so that we&#039;re not loading unecessary scripts in the admin

wp_register_script(&#039;cycle&#039;, get_bloginfo(&#039;template_directory&#039;)  . &#039;/scripts/jquery.cycle.all.min.js&#039;, array(&#039;jquery&#039;), &#039;1.0&#039;);

wp_enqueue_script(&#039;slideshow-activate&#039;,  get_bloginfo(&#039;template_directory&#039;)  . &#039;/scripts/slideshow-activate.js&#039;, array(&#039;jquery&#039;, &#039;cycle&#039;), &#039;1.0&#039;);

}
</pre>
<p>And then, don&#8217;t forget to put the 2 files into /scripts in your theme folder&#8230;</p>
<p>That should give you a working slideshow &#8211; ready to be styled with some CSS. Note that the way the Cycle plugin works is that it looks to rotate the immediate children of the div being called &#8211; here, they&#8217;re images, they could be eg. divs &#8211; so if you add a wrapper div(s) you may need to adjust slideshow-activate.js.</p>
<p>And if it&#8217;s not working, check first that the right scripts (jQuery, Cycle, slideshow-activate) are actually being loaded and in the right order, by looking at the page source &#8211; and check you&#8217;ve got thumbnails attached to the relevant posts&#8230;</p>
<p>You could go on to tidy this up &#8211; avoiding the hard-coded category id by having something in the theme options admin to change the id for example. Also, as said earlier, there&#8217;s a lot of scope in playing with the plugin parameters to get exactly the slideshow you want&#8230;</p>
<p>Lastly &#8211; the record of the duplicates we kept &#8211; the method for omitting them from subsequent Loops of posts is here: <a href="http://themocracy.com/2010/01/multiple-wordpress-queries-duplicates/">Multiple WordPress query duplicates</a></p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/jquery-slideshow-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WordPress Comments Plugins</title>
		<link>http://themocracy.com/2010/02/wordpress-comments-plugins/</link>
		<comments>http://themocracy.com/2010/02/wordpress-comments-plugins/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 06:27:41 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[comments]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=239</guid>
		<description><![CDATA[We spend enough time on the blog content and then tend to forget about the comments part. Comments are the way to get people involved - build up a blog's readership etc etc. A few, sensible, comments trickling in will freshen up a page's content and make it not seem completely dead in the water to passing search engine crawlers...

And the good news, there's plenty of comment-related plugins available to get the job done.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwordpress-comments-plugins%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwordpress-comments-plugins%2F" height="61" width="51" /></a></div><p><img class="alignright size-full wp-image-240" title="comments" src="http://themocracy.com/wp-content/uploads/2010/02/comments.gif" alt="" width="128" height="128" /><strong>We spend enough time on the blog content and then tend to forget about the comments part</strong>. Comments are the way to get people involved &#8211; build up a blog&#8217;s readership etc etc. A few, sensible, comments trickling in will freshen up a page&#8217;s content and make it not seem completely dead in the water to passing search engine crawlers&#8230;</p>
<p>And the good news, there&#8217;s plenty of comment-related plugins available to get the job done.<br />
<span id="more-239"></span><br />
First up, though, before anything else &#8211; make sure your WP theme and wordpress version are capable of handling threaded- (definitely) and paged- (probably) comments.</p>
<h3>The Plugins</h3>
<p><strong>Added Value for Comments</strong></p>
<p><a href="http://www.semiologic.com/software/dofollow/">DoFollow</a><br />
By default, WordPress slaps a nofollow attribute on any comment author&#8217;s web site link displayed &#8211; if you&#8217;re not sure what nofollow is, more info <a href="http://www.semiologic.com/resources/seo/nofollow/">here</a>. DoFollow removes this attribute from web site links in comments so search engines can follow them &#8211; offering an incentive for people to leave a sensible, or otherwise, comment as they pass by. Which is clearly going to attract spammers as well &#8211; always use together with comment moderation.<br />
<img class="alignright size-full wp-image-241" title="mw402" src="http://themocracy.com/wp-content/uploads/2010/02/mw402.png" alt="" width="190" height="87" /><br />
<a href="http://comluv.com/">CommentLuv</a><br />
An elaboration of the first &#8211; more incentives to leave a comment by displaying info about the commentator&#8217;s site, with links, such as a selection of their latest blog posts, tweets or diggs.<br />
<a href="http://wordpress.org/extend/plugins/subscribe-to-comments/"><br />
Subscribe to Comments</a><br />
Enables commentators to sign up for email notification of subsequent comments &#8211; so they can keep in the flow of the discussion.<br />
One operating annoyance with this setup &#8211; not the fault of the plugin &#8211; involves the dicks who comment using an email address they&#8217;ve slapped a spam authentication filter on &#8211; so that the poor old WP webmaster gets an email demand for authentication for every subsequent comment until they get round to deleting the offender  &#8211; a little knowledge being a dangerous thing etc.</p>
<h3>Displaying Comments</h3>
<p><a href="http://media.smashingmagazine.com/cdn_smash/images/twitter-avatars-wordpress-comments-plugin/twittar.zip">Twittar </a><br />
Displays, as an alternative to Automattic&#8217;s gravatar, the comentator&#8217;s Twitter avatar &#8211; if existent&#8230;</p>
<p><img class="alignright size-full wp-image-242" src="http://themocracy.com/wp-content/uploads/2010/02/mw401.png" alt="" width="252" height="57" /><a href="http://www.gdstarrating.com/downloads/plugin/">GD Star Rating</a><br />
Does depend on the context of your blog, as to whether a comments rating system has value &#8211; might be overkill for the average blog&#8230;</p>
<p><a href="http://wordpress.org/extend/plugins/gravatar-signup/">Gravatar Signup</a><br />
Adds a checkbox to the comment form for users who don&#8217;t have a Gravatar, giving the option to then go on and sign up for one. Prevents the march of grey men down blog comments&#8230;</p>
<p><a href="http://wordpress.org/extend/plugins/easy-comment-uploads/">Easy Comment Uploads</a><br />
Allows a commentator to upload images or other files, togehter with adding their comment &#8211; with lightbox display for all added images. It&#8217;s obviously wise to be conservative about which file-types you let visitors upload &#8211; especially for non-image types.</p>
<p><a href="http://wordpress.org/extend/plugins/ajax-comment-preview/">Ajax Comment Preview</a><br />
Runs the comment text through the WordPress filters to show a preview &#8211; can be useful if commentators are likely to be adding code snippets etc.</p>
<p>Not  &#8220;comments&#8221; plugins as such, but&#8230; There are lots of ways of displaying and defining &#8220;Popular Posts&#8221; &#8211; simplest is to go for the posts with the most comments, for example:-</p>
<p><a href="http://wordpress.org/extend/plugins/most-commented/">Most Commented Widget</a><br />
Adds a sidebar widget displaying an ordered list of the posts/pages with the most comments &#8211; shows where the action is.</p>
<p><a href="http://wordpress.org/extend/plugins/top-commentators-widget/">Top Commentators Widget</a><br />
Appeal to their vanity&#8230; and gain spammers.</p>
<h3>Anti-Spam Comment Plugins</h3>
<p>There&#8217;s always Akismet, but there&#8217;s also:</p>
<p><a href="http://wordpress.org/extend/plugins/bad-behavior/">Bad Behavior </a><br />
Attempts to filter out bots by analyzing HTTP requests. Does seem to make a significant difference in server load, monthly bandwidth, for well-established blogs.</p>
<p><a href="http://wordpress.org/extend/plugins/openid/">OpenID</a><br />
Asks commentators to sign in before commenting, using their OpenID.<br />
(Update: doesn&#8217;t seem 100% functional at the time of writing&#8230;)</p>
<p>One small warning &#8211; quite a lot of the plugins offered in the WordPress plugin repository are broken or obsolete, due to the arrival of threaded and paged comments. They (probably) won&#8217;t break the whole install if you run them, but don&#8217;t be too surprised if they don&#8217;t do what they&#8217;re supposed to&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/wordpress-comments-plugins/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress Action Hooks &#8211; the simplified version</title>
		<link>http://themocracy.com/2010/02/wordpress-action-hooks-the-simplified-version/</link>
		<comments>http://themocracy.com/2010/02/wordpress-action-hooks-the-simplified-version/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 09:09:01 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=237</guid>
		<description><![CDATA[WordPress action hooks allow you to access the functions of the core WP code, without messing around with that code. It's the basis for most plugins (the whole business essentially started out as the plugin API), but themes are using them more and more and there's no reason not to...

do_action/add_action are also the means of getting external scripts, CSS, javascript/jQuery correctly on the page.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwordpress-action-hooks-the-simplified-version%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwordpress-action-hooks-the-simplified-version%2F" height="61" width="51" /></a></div><p><strong>There&#8217;s no point in hacking around with the WordPress core code.</strong> You still see people doing it sometimes and happily showing off their results, but it just isn&#8217;t a good idea. Nobody else can use it without making the same hack(s), which aren&#8217;t carried through an automatic update anyway. </p>
<p>WordPress action hooks allow you to access the functions of the core WP code, without messing around with that code. It&#8217;s the basis for most plugins (the whole business essentially started out as the plugin API), but themes are using them more and more and there&#8217;s no reason not to&#8230; <strong>do_action/add_action are also the means of getting external scripts, CSS, javascript/jQuery correctly on the page.</strong><br />
<span id="more-237"></span><br />
WordPress pre-dates PHP5 and the improvements available in terms of Object-Orientated Programming (OOP). So, while there are obviously classes and objects in there, everything has a flow &#8211; once the PHP engine has compiled the code, it&#8217;s run from top to bottom &#8211; it&#8217;s procedural, as they say. </p>
<p>Instead of adding a method to a class, or extending a class with another class, there are points in the action where the possibility of doing something is left open &#8211; <strong>action hooks</strong> &#8211; either predefined, because they&#8217;ve been put in the core code, or you can create your own.</p>
<p>The means of doing it involve a couple of functions&#8230;   </p>
<h3>do_action() and add_action()</h3>
<p>Simply, <strong>do_action()</strong> is the function to create an action hook.</p>
<p>Whereas <strong>add_action()</strong> is tacking actions onto a given hook and always refers to a function that will called at that point.</p>
<pre class="brush: php">

&lt;?php do_action( $tag, $arg ); ?&gt;

&lt;?php add_action( $tag, $function_to_add, $priority, $accepted_args ); ?&gt;
</pre>
<p>The $tag is the action hook itself, a description of &#8220;where&#8221; &#8211; at what point in the action&#8230;</p>
<p>As an example, we can create an action hook that outputs some content on the home page just before the Loop of posts is output. </p>
<p>so in <strong>home.php</strong></p>
<pre class="brush: php">
 &lt;?php

 do_action( &#039;before_the_index_loop&#039; ); 

    if (have_posts()) : while (have_posts()) : the_post();
     //etc etc
?&gt;
</pre>
<p>and in <strong>functions.php</strong></p>
<pre class="brush: php">

add_action( &#039;before_the_index_loop&#039;, &#039;my_helloworld_display&#039; );

function my_helloworld_display(){

 echo &quot;&lt;p&gt;This is my hello to the world&lt;/p&gt;&quot;;

}
</pre>
<p>At the point where it reaches the action hook ( &#8216;before_the_index_loop&#8217; ) put there by the do_action, it finds a function (my_helloworld_display) to call and calls it. </p>
<p>(Or you could put this in index.php and test whether it&#8217;s running as the home page by using is_home().) </p>
<h3>Priority</h3>
<p>Everything has an order &#8211; lower to higher &#8211; and if you don&#8217;t specify it, the default value of an action is 10.</p>
<p>So here, as an example, we can add an action earlier in the document flow that&#8217;s actually going to be run <em>after</em> the next add_action.</p>
<pre class="brush: php">

add_action( &#039;my_helloworld&#039;, &#039;my_second_helloworld_display&#039;, 20);
add_action( &#039;my_helloworld&#039;, &#039;my_helloworld_display&#039;);

function my_second_helloworld_display(){
 echo &quot;&lt;p&gt;Hello again to the world&lt;/p&gt;&quot;;
}

function my_helloworld_display(){
 echo &quot;&lt;p&gt;Hello to the world&lt;/p&gt;&quot;;
}
</pre>
<p>Will produce:</p>
<blockquote><p>
Hello to the world<br />
Hello again to the world
</p></blockquote>
<h3>Accepted arguments</h3>
<p>In, say, <strong>header.php</strong>, we can place a hook with some arguments:</p>
<pre class="brush: php">

do_action( &#039;my_details&#039;, get_bloginfo(&#039;name&#039;), get_bloginfo(&#039;description&#039;));
</pre>
<p>While in <strong>functions.php</strong> we&#8217;re going to expect 2 arguments to be passed to the function.</p>
<pre class="brush: php">

add_action( &#039;my_details&#039;, &#039;my_details_display&#039;, 10 ,2);

function my_details_display($name, $description){

 echo &quot;&lt;p&gt;This is the name of my blog: {$name} and this is its description: {$description}&lt;/p&gt;&quot;;
}
</pre>
<p>(Of course, this is just for the very simple example of it, to show how arguments are passed to any function referenced by an add_action &#8211;  the whole process could have been short-cut just by putting bloginfo(&#8216;name&#8217;) on the page&#8230;)</p>
<p>In practice, it can be slightly tricky to find out the what and how many of arguments are being passed to predefined action hooks &#8211; that&#8217;s when you do have to look into the core code.</p>
<p>And just for experiment (on a development site, don&#8217;t leave lying around on anything live)</p>
<pre class="brush: php">

add_action(&#039;wp&#039;, &#039;my_vardump&#039;);

function my_vardump($query){
	global $post;
	print_r($query);
	print_r($post);
}
</pre>
<p>Just to see what&#8217;s available to play with&#8230; </p>
<p>There are a lot of action hooks strewn around the place in WordPress code already &#8211; not all of them are terribly well-documented, (it&#8217;s a large job). The thing to do is to consult first the <a href="http://codex.wordpress.org/Plugin_API/Action_Reference">Codex</a> for the main list of hooks and then experiment, adding your own hooks and making use of those already there. At least, action hooks do simplify the whole process &#8211; it&#8217;s only one line of code to comment out if things start going wrong. </p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/wordpress-action-hooks-the-simplified-version/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How&#8217;s Twitter doing these days?</title>
		<link>http://themocracy.com/2010/02/hows-twitter-doing/</link>
		<comments>http://themocracy.com/2010/02/hows-twitter-doing/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 10:52:19 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[cotweet]]></category>
		<category><![CDATA[socialoomph]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=235</guid>
		<description><![CDATA[Some thoughts on Twitter and how it affects the average WordPress blogger presently :- how to get value out of it, what to avoid and how to maintain a decent etiquette - it does seem to have grown slightly in the last year or so.

Success requires 2-way communication. "Broadcasters" - you know the ones... Their profile says 3 following 12,455 followers - they're not being a success via Twitter, they're trading off an established reputation.

It would be nice not to have to do the work, but if you're starting at the bottom... you'll have to do the work, no one else will. Follow those who follow you. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fhows-twitter-doing%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fhows-twitter-doing%2F" height="61" width="51" /></a></div><p><img src="http://themocracy.com/wp-content/uploads/2010/02/twitter2.gif" alt="" title="twitter" width="150" height="150" class="alignright size-full wp-image-236" /><strong>Some thoughts on Twitter and how it affects the average WordPress blogger presently</strong> :- how to get value out of it, what to avoid and how to maintain a decent etiquette &#8211; it does seem to have grown slightly in the last year or so.</p>
<p><strong>Success requires 2-way communication</strong>. &#8220;Broadcasters&#8221; &#8211; you know the ones&#8230; Their profile says 3 following 12,455 followers &#8211; they&#8217;re not being a success via Twitter, they&#8217;re trading off an established reputation.</p>
<p>It would be nice not to have to do the work, but if you&#8217;re starting at the bottom&#8230; you&#8217;ll have to do the work, no one else will. Follow those who follow you.<br />
<span id="more-235"></span><br />
<strong>Twitter is networking, linking, creating connections</strong>, so there&#8217;s logic in not just tweeting your own content.<br />
If someone tweets your content tweet about theirs and/or retweet them. People do respond well to being talked up &#8211; shameless, I know, but we are creatures of vanity. Giving someone a positive mention can pay a dividend. You can give them a recommendation at <a href="http://mrtweet.com/home">MrTweet</a> and elsewhere, and there&#8217;s always <strong>#followfriday</strong>.</p>
<p>Note that there are 2 competing factors with retweeting someone else&#8217;s content.</p>
<ol>
<li>You want to keep retweets vaguely accurate to your niche, obviously </li>
<li>But you&#8217;ll want to introduce your followers to someone/something new &#8211; they&#8217;ll think of you as authoritative, god forbid&#8230;</li>
</ol>
<p>Try to keep a handle on what you retweet, it&#8217;s all too easy to get carried away by the urge to fill up the timeline and look busy.  So careful who you recommend and retweet because it all reflects on you. Avoid the gimmicks of you follow me, I&#8217;ll follow you etc etc. looks tacky&#8230;.</p>
<p><strong>And do watch out for shortened urls</strong> &#8211; don&#8217;t display or retweet anything you haven&#8217;t first checked, and that definitely includes anything that arrives in a comment.</p>
<p>The nature of Twitter now is that nobody can read all their tweets &#8211; so a little bit of duplicate tweeting for your own content has its value. Too much and the risk is obvious, so maybe if you&#8217;re tweeting up a new blog post, mention it a couple of times on the day and then again a couple of days later, no great harm in that. Schedule &#8211; a little bit. <a href="http://www.socialoomph.com/">Socialoomph</a>, <a href="http://cotweet.com/">CoTweet</a> and others have the means to schedule your priceless content.</p>
<p>But definitely &#8211; we&#8217;re not always as good at this as we&#8217;d like to be &#8211; make some reply to your @mentions, if they&#8217;re not completely auto-generated. </p>
<p>On the other hand again, it&#8217;s more difficult, and probably not efficient, to keep up with all your direct messages &#8211; far too many of these are auto-generated marketing drivel. So there&#8217;s probably no good reason to DM somebody if you want to make sensible contact &#8211; you might try tweeting an @mention as well to indicate you sent a DM&#8230;  </p>
<p><strong>Don&#8217;t bother to get annoyed if someone makes no response</strong> &#8211; they may be far too busy with other things, they may be grateful but not inclined to fill up their timeline with mutual congratulations, they may be a bit of a tosser. Who knows&#8230; Don&#8217;t take it personally, get on with what&#8217;s next&#8230;</p>
<p>And lastly &#8211; <strong>waste no time on the pointless building of followers</strong>. There are good and bad followers, but the vast majority are meaningless followers. Yes, I know there are a few things around the web that reward huge metrics, but you&#8217;re sending out a tweet that even if noticed is never going to be in the sphere of interest of the noticer &#8211; what&#8217;s the point?</p>
<p>My guess, and that of others, is that Twitter is starting to fight a battle with its signal-to-noise ratio, other options such as FriendFeed seem to have their advantages (for how long&#8230;?) so it is up to you to keep it relevant&#8230; </p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/hows-twitter-doing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Intrepid Free WordPress Theme</title>
		<link>http://themocracy.com/2010/02/intrepid-free-wordpress-theme/</link>
		<comments>http://themocracy.com/2010/02/intrepid-free-wordpress-theme/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 16:12:11 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Free]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=228</guid>
		<description><![CDATA[Intrepid is a free WordPress theme, two-column with a right sidebar, compatible with WordPress version 2.8 upwards, with threaded and paged comments. 3 styles of pastel shades to choose from - blue-green, green-brown and purple-gray as default... You can also replace the header completely with your own image.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fintrepid-free-wordpress-theme%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fintrepid-free-wordpress-theme%2F" height="61" width="51" /></a></div><p><a href="http://themocracy.com/demo/?t=7"><img class="alignright size-full wp-image-233" title="intrepid-free-wordpress-theme" src="http://themocracy.com/wp-content/uploads/2010/02/intrepid-free-wordpress-theme.jpg" alt="" width="262" height="183" /></a><strong>Intrepid</strong> is a free WordPress theme, two-column with a right sidebar, compatible with WordPress version 2.8 upwards, with threaded and paged comments. 3 styles of pastel shades to choose from &#8211; blue-green, green-brown and purple-gray as default&#8230; You can also replace the header completely with your own image.<br />
<span id="more-228"></span><br />
Version 1.1 has been tested on Firefox 3, Internet Explorer 6 &amp; 7, Google Chrome, Opera 9.</p>
<p><strong>Features</strong></p>
<ul>
<li>jQuery dropdown pages menu &#8211; configure the item order and exclude pages</li>
<li>Add your own logo in the header</li>
<li>3 pre-defined color schemes (so far&#8230;)</li>
</ul>
<p><strong>Demo:</strong> <a href="http://themocracy.com/demo/?t=7">Intrepid demo</a></p>
<p><img style=" vertical-align:-5px;" class="alignnone size-full wp-image-234" title="theme download" src="http://themocracy.com/wp-content/uploads/2010/02/download_small.gif" alt="wordpress theme download" width="25" height="24" /> <strong>Download</strong>: Intrepid WordPress Theme v1.1 &#8211; <a href="http://themocracy.com/extra/themes/intrepid.zip">intrepid.zip</a>  (Compatible with WP > version2.8)</p>
<p>This theme is released under the terms of the GPL licence.</p>
<p>Our free themes are supplied “as is” – <em>sorry, but we don’t have the resources to offer support for email enquiries or comments about individual installation/customisation</em>. You’re free to use and modify them as you wish, but we would ask you to retain the credit link in the footer.</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/intrepid-free-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress 2.9 &#8211; Using Post Thumbnails</title>
		<link>http://themocracy.com/2010/02/wordpress-2-9-using-post-thumbnails/</link>
		<comments>http://themocracy.com/2010/02/wordpress-2-9-using-post-thumbnails/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 11:20:20 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[thumbnails]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=229</guid>
		<description><![CDATA[With WordPress 2.9 comes a revised image thumbnail system &#8211; previously, support for posts with attached thumbnails was a little haphazard (it is a fiddly business in terms of the programming), but this is a significant step forward. The need is for a series of images, of given size, associated with a series of posts [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwordpress-2-9-using-post-thumbnails%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fwordpress-2-9-using-post-thumbnails%2F" height="61" width="51" /></a></div><p><img src="http://themocracy.com/wp-content/uploads/2010/02/wordpress-admin-thumbnail-widget.png" alt="" title="wordpress-admin-thumbnail-widget" width="307" height="212" class="alignright size-full wp-image-231" /><strong>With WordPress 2.9 comes a revised image thumbnail system</strong> &#8211; previously, support for posts with attached thumbnails was a little haphazard (it is a fiddly business in terms of the programming), but this is a significant step forward.</p>
<p>The need is for a series of images, of given size, associated with a series of posts &#8211; maybe for a front page with post excerpts and their images, or for a featured posts slideshow. Before 2.9, every theme developer had a different way of doing it &#8211; some with patent recipes for determining (guessing) which thumbnail was attached to which posts, while other themes required the web admin to add a thumbnail custom meta field manually, a bit tiresome.<br />
<span id="more-229"></span></p>
<h3>add_theme_support()</h3>
<p>Firstly, you do have to explicitly declare the new thumbnail system in <strong>functions.php</strong> &#8211; and best to wrap it up in an &#8220;if function exists&#8221; to avoid problems for older WP installs.</p>
<pre class="brush: php">
// to prevent  WP &lt; 2.9 breaking
if (function_exists(&#039;add_theme_support&#039;)) {
add_theme_support( &#039;post-thumbnails&#039; );
}
</pre>
<p>This produces a whole new little widget on admin post edit pages. In terms of admin, you can now attach a thumbnail image to a post using this widget, (or by adding an image via the media gallery, as before), and then taking the &#8220;Use as thumbnail&#8221; option<br />
<img src="http://themocracy.com/wp-content/uploads/2010/02/wordpress-admin-add-thumbnail.png" alt="" title="wordpress-admin-add-thumbnail" width="477" height="110" class="aligncenter size-full wp-image-230" /></p>
<h3>Usage</h3>
<p>Now, you have the <strong>has_post_thumbnail()</strong> and <strong>the_post_thumbnail()</strong> template tags available &#8211; so in the post loop,  say for <strong>home.php</strong></p>
<pre class="brush: php">
&lt;?php if ( has_post_thumbnail()) { ?&gt;

	&lt;div class=&quot;thumbnail&quot;&gt;
		&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;
		&lt;?php the_post_thumbnail(); ?&gt;&lt;/a&gt;
	&lt;/div&gt;

 &lt;?php	} ?&gt;
</pre>
<p><strong> has_post_thumbnail()</strong> tests whether a thumbnail exists for the post &#8211; if so, go on to display it with <strong>the_post_thumbnail()</strong>. You could also add an else here and go to display a default image if there isn&#8217;t a thumbnail</p>
<p>So far so good &#8211; but what size are the thumbnails going to be?</p>
<h3>Sizing Thumbnails</h3>
<p>This is where the complications arrive &#8211; but the good news there&#8217;s now various ways to control the whole system, giving you a better chance of getting what you want, fairly painlessly&#8230; There&#8217;s 3 main ways of doing it.</p>
<p>First, you can specify the image dimensions directly as variables in the template tag</p>
<pre class="brush: php">
	the_post_thumbnail(array(150,90));
</pre>
<p>Note that the variable is an array. This method is fine enough if the theme is simply using one size of thumbnail &#8211; it does give some odd results if you start elaborating, with different sizes on different pages, so&#8230; </p>
<p>Secondly, back in <strong>functions.php</strong></p>
<pre class="brush: php">
if (function_exists(&#039;add_theme_support&#039;)) {
add_theme_support(&#039;post-thumbnails&#039;);
set_post_thumbnail_size(150, 90, true);
}
</pre>
<p>The set_post_thumbnail_size gives a default, here 150px width, 90px height &#8211; the 3rd variable is the &#8220;hard-crop&#8221; flag mode. 2 ways to go here, box-resizing (flag= false) and hard-cropping (flag=true).</p>
<p><strong>Box resizing </strong> = shrinks an image until it fits the width or height value you&#8217;ve specified. So with this method, you always get the whole image in the thumbnails, but the thumbnails themselves might turn out to be different sizes, width or height.</p>
<p><strong>Hard-cropping</strong> = the image is cropped to match the aspect ratio &#8211; width : height &#8211; and then shrunk to fit. So here you get all thumbnails the same size, but they may be missing cropped parts top/bottom or left/right. In practice, for general theme development, this is usually the best way to go.</p>
<p>Thirdly for sizing, you can use <strong>add_image_size()</strong></p>
<pre class="brush: php">
if (function_exists(&#039;add_theme_support&#039;)) {
	add_theme_support( &#039;post-thumbnails&#039; );
	set_post_thumbnail_size( 150, 90, true ); // default thumbnail size
	add_image_size(&#039;index-thumbnail&#039;, 120, 75); // for front page thumbnails
	add_image_size(&#039;single-post-thumbnail&#039;, 300, 180); // a different thumbnail size on single post pages
}
</pre>
<p>Now, you&#8217;ve done all the hard work and can be used very simply like this:</p>
<pre class="brush: php">
	&lt;?php the_post_thumbnail(&#039;index-thumbnail&#039;); ?&gt;
</pre>
<p>Here, you have the most control over what&#8217;s going on.</p>
<p>I suspect there may be one or two refinements in the pipeline, but these methods have made it much easier to handle thumbnails in themes &#8211; not least you won&#8217;t have to show users how to add custom fields manually. Good effort&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/wordpress-2-9-using-post-thumbnails/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Using Google Code libraries with WordPress</title>
		<link>http://themocracy.com/2010/02/using-google-code-libraries-with-wordpress/</link>
		<comments>http://themocracy.com/2010/02/using-google-code-libraries-with-wordpress/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:54:40 +0000</pubDate>
		<dc:creator>Lisa</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://themocracy.com/?p=224</guid>
		<description><![CDATA[By default, WordPress loads the version of jQuery that comes with the package. But there is an alternative way of doing it and that&#8217;s to use the AJAX Libraries API at Google Code &#8211; use their bandwidth, why not&#8230; A few lines added to your functions.php in the theme you&#8217;re building and you&#8217;re ready to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fusing-google-code-libraries-with-wordpress%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fthemocracy.com%2F2010%2F02%2Fusing-google-code-libraries-with-wordpress%2F" height="61" width="51" /></a></div><p><img class="alignright size-full wp-image-207" title="wordpress-250x250" src="http://themocracy.com/wp-content/uploads/2010/01/wordpress-250x250.png" alt="" width="192" height="192" /><strong>By default, WordPress loads the version of jQuery that comes with the package.</strong> But there is an alternative way of doing it and that&#8217;s to use the AJAX Libraries API at Google Code &#8211; use their bandwidth, why not&#8230;</p>
<p>A few lines added to your functions.php in the theme you&#8217;re building and you&#8217;re ready to go.<br />
<span id="more-224"></span><br />
<strong> wp_register_script()</strong> &#8211; the useful point is that you can use this function to access scripts hosted elsewhere&#8230;</p>
<p>Just add this code to your <strong>functions.php</strong> file:</p>
<pre class="brush: php">
add_action(&#039;template_redirect&#039;, &#039;js_head_load&#039;);

function js_head_load(){

if(is_admin()) return;

wp_deregister_script(&#039;jquery&#039;);
wp_register_script(&#039;jquery&#039;, &#039;http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js&#039;);
wp_enqueue_script(&#039;jquery&#039;);
// and then any other scripts to register and queue...
}
</pre>
<p>Notice the first line of the function ensures that the jQuery isn&#8217;t loaded on WP admin pages -<em> if a script isn&#8217;t needed, don&#8217;t load it on the page</em> &#8211; and in this case jQuery in noConflict mode  can cause the admin rich text editor and the widget drag and drop interface to go awry..</p>
<p><strong>The advantages</strong>:-<br />
You&#8217;ll be able to update the version your site is using quickly and easily, probably a good thing.</p>
<p>Google Code tends to have a policy of only including versions demonstrated to be stable, jQuery 1.2.4 and 1.2.5 didn&#8217;t make the grade</p>
<p>The user may already have it cached in their browser via some previously visited site instead of downloading from a location on your site (and if enough sites do it, the chances are that much greater that they will have a copy in the cache).</p>
<p>Not just jQuery &#8211; check out jQuery UI<br />
<a href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js">http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js</a><br />
And MooTools, which seems seriously under-used in conjunction with WordPress<br />
<a href="http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js">http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js</a></p>
<p>Always grab the minified version.</p>
<p>And lastly, one disadvantage:- googleapis.com does go down very occasionally &#8211; but then again a site ought to function, more or less, without javaScript.</p>
]]></content:encoded>
			<wfw:commentRss>http://themocracy.com/2010/02/using-google-code-libraries-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

