<?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>Flour Power &#187; Wordpress</title>
	<atom:link href="http://antoniofarinha.com/blog/category/blogging/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://antoniofarinha.com/blog</link>
	<description>a blog by António Farinha</description>
	<lastBuildDate>Tue, 27 Mar 2012 16:09:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>WordPress 2.8, Codename &#8220;Baker&#8221;, Now Available</title>
		<link>http://antoniofarinha.com/blog/2009/06/11/wordpress-2-8-codename-baker-is-out/</link>
		<comments>http://antoniofarinha.com/blog/2009/06/11/wordpress-2-8-codename-baker-is-out/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 12:33:09 +0000</pubDate>
		<dc:creator>Farinha</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress 2.8]]></category>

		<guid isPermaLink="false">http://antoniofarinha.com/blog/?p=1191</guid>
		<description><![CDATA[WordPress, the blog engine that powers this blog, has released it&#8217;s version 2.8, codenamed &#8220;Baker&#8221; (in dedication to the famed jazz musician Chet Baker). I&#8217;m not going into a lot of detail because you can see an explanation of the changes here and here, but the highlights are: New (easier to use) theme install capabilities; Syntax [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-1192" title="Wordpress logo" src="http://antoniofarinha.com/blog/wp-content/uploads/2009/06/wordpress-logo-200x200.jpg" alt="Wordpress logo" width="200" height="200" /><a href="http://wordpress.org/" target="_blank">WordPress</a>, the blog engine that powers this blog, has released it&#8217;s version 2.8, codenamed &#8220;Baker&#8221; (in dedication to the famed jazz musician <a href="http://en.wikipedia.org/wiki/Chet_Baker" target="_blank">Chet Baker</a>).</p>
<p>I&#8217;m not going into a lot of detail because you can see an explanation of the changes <a href="http://wordpress.org/development/2009/06/wordpress-28/" target="_blank">here</a> and <a href="http://codex.wordpress.org/Version_2.8" target="_blank">here</a>, but the highlights are:</p>
<ul>
<li>New (easier to use) theme install capabilities;</li>
<li>Syntax highlighting in the code editor (apparently not working in Google Chrome);</li>
<li>Improved Widget user interface and support for using more than one widget of the same type;</li>
<li>New screen options in every page to better organize the items on the screen.</li>
</ul>
<p>Also, WordPress claims they made a lot of speed improvements and corrected hundreds of bugs.</p>
<p>I&#8217;ve successfully upgraded to the new version via the automatic update (not without making a <a href="http://codex.wordpress.org/WordPress_Backups" target="_blank">backup</a> first) and everything seems to be working fine. Let me know if you detect any issues.</p>
<p><a href="http://wordpress.org/download/" target="_blank">Download page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://antoniofarinha.com/blog/2009/06/11/wordpress-2-8-codename-baker-is-out/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress Hack &#8211; Displaying Popular Posts</title>
		<link>http://antoniofarinha.com/blog/2009/02/12/wordpress-hack-displaying-popular-posts/</link>
		<comments>http://antoniofarinha.com/blog/2009/02/12/wordpress-hack-displaying-popular-posts/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 19:46:53 +0000</pubDate>
		<dc:creator>Farinha</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[popular]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://antoniofarinha.com/blog/?p=276</guid>
		<description><![CDATA[On my quest to improve this blog, I just added a way of keeping track of how many views each post has, as well as a list of the most viewed (see the footer). I followed a tip from Pedro (blog in Portuguese) and went for the WP-PostViews plugin. It basically adds a couple of fields [...]]]></description>
			<content:encoded><![CDATA[<p>On my quest to improve this blog, I just added a way of keeping track of how many views each post has, as well as a list of the most viewed (see <a href="http://antoniofarinha.com/blog/#footer" target="_self">the footer</a>).</p>
<p>I followed a tip from <a href="http://blog.aloneinkyoto.net/" target="_blank">Pedro</a> (blog in Portuguese) and went for the <a href="http://wordpress.org/extend/plugins/wp-postviews/" target="_blank">WP-PostViews</a> plugin. It basically adds a couple of fields in the database and some functions to update each post&#8217;s view count and display it.</p>
<p>The installation is very easy. It&#8217;s all explained <a href="http://lesterchan.net/wordpress/readme/wp-postviews.html" target="_blank">here</a>, including how to use it. Basically: install (you can use the WordPress auto installer), activate, and then add a snippet of code wherever you want the info displayed.</p>
<pre class="prettyprint">&lt;?php if (function_exists('get_most_viewed')): ?&gt;
   &lt;ul&gt;
      &lt;?php get_most_viewed(); ?&gt;
   &lt;/ul&gt;
&lt;?php endif; ?&gt;</pre>
<p>That&#8217;s the code to display the most viewed posts. You can also display the least viewed and the count for each individual post.</p>
<p>More plugins can be found from the same guy who did this one, <a href="http://lesterchan.net/portfolio/programming/php/" target="_blank">Lester Chen</a>. I might take a look at them in the future, there seems to be some neat stuff there.</p>
]]></content:encoded>
			<wfw:commentRss>http://antoniofarinha.com/blog/2009/02/12/wordpress-hack-displaying-popular-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Hack &#8211; Float a Specific Set of Posts to the Top of the Main Page</title>
		<link>http://antoniofarinha.com/blog/2009/02/09/wordpress-hack-float-a-specific-set-of-posts-to-the-top-of-the-main-page/</link>
		<comments>http://antoniofarinha.com/blog/2009/02/09/wordpress-hack-float-a-specific-set-of-posts-to-the-top-of-the-main-page/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 15:36:20 +0000</pubDate>
		<dc:creator>Farinha</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[Sticky]]></category>

		<guid isPermaLink="false">http://antoniofarinha.com/blog/?p=181</guid>
		<description><![CDATA[This is the first post of what I expect to become a series about WordPress hacks, i.e., small tweaks that I&#8217;ll be doing to customize this blog&#8217;s WordPress functionality. The most observant of readers might have noticed something that can look a bit weird. The order of the posts in the blog&#8217;s main page is not [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first post of what I expect to become a series about WordPress hacks, i.e., small tweaks that I&#8217;ll be doing to customize this blog&#8217;s WordPress functionality.</p>
<p>The most observant of readers might have noticed something that can look a bit weird. The order of the posts in the blog&#8217;s main page is not the same as the order in &#8220;Recent Posts&#8221; or in the <a href="http://antoniofarinha.com/blog/feed/" target="_self">RSS Feed</a>. What&#8217;s happening is I&#8217;m making some posts &#8220;sticky&#8221;, that is, they&#8217;ll cling to the top of the homepage even if I post something else afterwards, instead of just having all the post showing up in reverse chronological order.</p>
<p>Let me explain the reason for this. The main objective of this blog is to share my personal adventures now that I left my hometown to work abroad. But sometimes I like to post some other random stuff, like the review of a TV show, some cool web application,  a rant about something that&#8217;s annoying me, or just something funny I found on the Internet. To help keeping the blog on track, I&#8217;ve chosen to always float the latest post from the <a href="http://antoniofarinha.com/blog/category/personal/" target="_self">Personal category</a> (the one where I file all the posts related to my day-to-day happenings) to the top. This way, blog visitors will always see one post from that category at the top of the homepage.</p>
<p>OK, now for the hack itself. The WordPress main page is basically a loop that goes through all the published posts and displays them:</p>
<pre class="prettyprint">&lt;?php
if (have_posts()) : ?&gt;
  &lt;?php while (have_posts()) : the_post(); ?&gt;
  // display post and related metadata
&lt;?php endwhile; ?&gt;</pre>
<p>So, to achieve the intended functionality, I added some code to display the post I want floated to the top. It&#8217;s basically the same as the main loop, but I use <a href="http://www.google.co.uk/url?sa=U&amp;start=1&amp;q=http://codex.wordpress.org/Function_Reference/WP_Query&amp;ei=aESQSeuHN8e_tgeLhPCHCw&amp;sig2=TybRL2i3U_DYu_tlO6940w&amp;usg=AFQjCNG034gER4Z3VYU42DKY2QGvvhlYCw" target="_blank">WP_Query()</a> to retrive the post I want to display. Note that you need to store the id of the post in some variable so that you can skip it in the main loop (or else it would show up twice). Also note that <a href="http://return-true.com/using-wp_query-to-make-custom-queries-within-wordpress-templates/282/" target="_blank">some tweeking</a> has to be done to account for a WordPress &#8220;feature&#8221; that makes the tags on the first post to disappear. The resulting code (cropped for simplicity) is:</p>
<pre class="prettyprint">// sticky post(s)
&lt;?php
$wp_query = null;
$wp_query = new WP_Query();
$wp_query-&gt;query('category_name=Personal&amp;showposts=1');
while ($wp_query-&gt;have_posts()) : $wp_query-&gt;the_post();
  $do_not_duplicate = $post-&gt;ID;?&gt;
  // display post and related metadata
&lt;?php endwhile; ?&gt;

// all the rest
&lt;?php
//query_posts('');
$wp_query = null;
$wp_query = $temp;
if (have_posts()) : ?&gt;
&lt;?php while (have_posts()) : the_post(); if( $post-&gt;ID == $do_not_duplicate) continue; ?&gt;
  // display post and related metadata
&lt;?php endwhile; ?&gt;</pre>
<p>You can easily control what you want displayed on top by parametrizing WP_Query() as you like. And the only change will be in the homepage, everything else will be in it&#8217;s &#8220;normal&#8221; state.</p>
<p><strong>UPDATE:</strong> It seems that this &#8220;hack&#8221; caused the pagination to stop working. To solve I just had to assign the <em>$temp</em> value we stored in the beginning to the <em>$wp_query</em> variable. The code above has been corrected. Full explanation <a href="http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://antoniofarinha.com/blog/2009/02/09/wordpress-hack-float-a-specific-set-of-posts-to-the-top-of-the-main-page/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

