<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Sort Posts by Comment Count in WordPress</title>
	<atom:link href="http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/</link>
	<description>PHP Tips &#38; Tools From Starters to Experts</description>
	<lastBuildDate>Sun, 15 Jan 2012 02:04:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Brett Sanders</title>
		<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/comment-page-1/#comment-728</link>
		<dc:creator>Brett Sanders</dc:creator>
		<pubDate>Wed, 19 Jan 2011 11:16:49 +0000</pubDate>
		<guid isPermaLink="false">http://phpstarter.net/?p=263#comment-728</guid>
		<description>Hi, this is exactly what I am after. Thanks.
I was just wondering what template you need to edit for this?
If you can help me at all that would be great.</description>
		<content:encoded><![CDATA[<p>Hi, this is exactly what I am after. Thanks.<br />
I was just wondering what template you need to edit for this?<br />
If you can help me at all that would be great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ted</title>
		<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/comment-page-1/#comment-714</link>
		<dc:creator>Ted</dc:creator>
		<pubDate>Mon, 22 Nov 2010 04:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://phpstarter.net/?p=263#comment-714</guid>
		<description>I hope you can help me.  I need to create a page that sort posts by recent comment, not by comment count in WordPress.  Many Thanks...
Ted
</description>
		<content:encoded><![CDATA[<p>I hope you can help me.  I need to create a page that sort posts by recent comment, not by comment count in WordPress.  Many Thanks&#8230;<br />
Ted</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Fields</title>
		<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/comment-page-1/#comment-574</link>
		<dc:creator>Michael Fields</dc:creator>
		<pubDate>Sat, 12 Jun 2010 04:08:36 +0000</pubDate>
		<guid isPermaLink="false">http://phpstarter.net/?p=263#comment-574</guid>
		<description>Hi I stumbled upon your site today while researching if this was possible. I found out that it was possible to accomplish this task without the use of a custom query. Here&#039;s the solution that I came up with:

add_filter( &#039;pre_get_posts&#039;, &#039;order_posts_by_comment_count&#039; );
function order_posts_by_comment_count( $query ) {
 if ( is_home() )
 $query-&gt;set( &#039;orderby&#039;, &#039;comment_count&#039; );
 $query-&gt;set( &#039;order&#039;, &#039;DESC&#039; );
 return $query;
}
best wishes,
-Mike

 </description>
		<content:encoded><![CDATA[<p>Hi I stumbled upon your site today while researching if this was possible. I found out that it was possible to accomplish this task without the use of a custom query. Here&#8217;s the solution that I came up with:</p>
<p>add_filter( &#8216;pre_get_posts&#8217;, &#8216;order_posts_by_comment_count&#8217; );<br />
function order_posts_by_comment_count( $query ) {<br />
 if ( is_home() )<br />
 $query-&gt;set( &#8216;orderby&#8217;, &#8216;comment_count&#8217; );<br />
 $query-&gt;set( &#8216;order&#8217;, &#8216;DESC&#8217; );<br />
 return $query;<br />
}<br />
best wishes,<br />
-Mike</p>
<p> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moyo</title>
		<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/comment-page-1/#comment-364</link>
		<dc:creator>moyo</dc:creator>
		<pubDate>Sun, 20 Sep 2009 07:54:58 +0000</pubDate>
		<guid isPermaLink="false">http://phpstarter.net/?p=263#comment-364</guid>
		<description>Looks like I&#039;ve found the solution by myself. Anyway thanks for your post.</description>
		<content:encoded><![CDATA[<p>Looks like I&#8217;ve found the solution by myself. Anyway thanks for your post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: moyo</title>
		<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/comment-page-1/#comment-361</link>
		<dc:creator>moyo</dc:creator>
		<pubDate>Fri, 18 Sep 2009 20:13:26 +0000</pubDate>
		<guid isPermaLink="false">http://phpstarter.net/?p=263#comment-361</guid>
		<description>Any ideas how to make this SQL for posts current category?</description>
		<content:encoded><![CDATA[<p>Any ideas how to make this SQL for posts current category?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc</title>
		<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/comment-page-1/#comment-344</link>
		<dc:creator>Marc</dc:creator>
		<pubDate>Tue, 21 Jul 2009 20:25:55 +0000</pubDate>
		<guid isPermaLink="false">http://phpstarter.net/?p=263#comment-344</guid>
		<description>Many thanks, especially for not sticking it in a plugin.</description>
		<content:encoded><![CDATA[<p>Many thanks, especially for not sticking it in a plugin.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kristarella</title>
		<link>http://phpstarter.net/2009/01/sort-posts-by-comment-count-in-wordpress/comment-page-1/#comment-278</link>
		<dc:creator>kristarella</dc:creator>
		<pubDate>Mon, 01 Jun 2009 16:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://phpstarter.net/?p=263#comment-278</guid>
		<description>Thanks! Just what I needed.

I couldn&#039;t get it to work until I changed &lt;code&gt;FROM wp_posts&lt;/code&gt; to &lt;code&gt;FROM $wpdb-&gt;posts&lt;/code&gt;. I&#039;m not sure if that&#039;s an error or perhaps a quirk because I&#039;m using WPMU.

Cheers.</description>
		<content:encoded><![CDATA[<p>Thanks! Just what I needed.</p>
<p>I couldn&#8217;t get it to work until I changed <code>FROM wp_posts</code> to <code>FROM $wpdb-&gt;posts</code>. I&#8217;m not sure if that&#8217;s an error or perhaps a quirk because I&#8217;m using WPMU.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

