<?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>iWP.me &#187; Popular Posts</title>
	<atom:link href="http://iwp.me/tag/popular-posts/feed/" rel="self" type="application/rss+xml" />
	<link>http://iwp.me</link>
	<description>All that stuffs about WordPress and Web Design!</description>
	<lastBuildDate>Tue, 07 Oct 2008 14:05:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to display popular posts without plugin?</title>
		<link>http://iwp.me/how-to-display-popular-posts-without-plugin/</link>
		<comments>http://iwp.me/how-to-display-popular-posts-without-plugin/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 22:54:32 +0000</pubDate>
		<dc:creator>Chada</dc:creator>
				<category><![CDATA[Theme Tips]]></category>
		<category><![CDATA[Popular Posts]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://iwp.me/?p=18</guid>
		<description><![CDATA[The same as &#8220;How to display random posts without plugin&#8221;, you can also display polular posts without plugin. Copy codes below and paste to your theme: < ?php function popular_posts($no_posts = 5, $before = ' ', $after = '', $show_pass_post &#8230; <a href="http://iwp.me/how-to-display-popular-posts-without-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The same as &#8220;How to display random posts without plugin&#8221;, you can also display polular posts without plugin.</p>
<p><a href="http://None"><img class="aligncenter size-full wp-image-19" title="popular" src="http://iwp.me/wp-content/uploads/2008/09/popular.gif" alt="" width="481" height="122" /></a><span id="more-18"></span></p>
<p>Copy codes below and paste to your theme:</p>
<pre lang="php">< ?php function popular_posts($no_posts = 5, $before = '
<li>', $after = '', $show_pass_post = false, $duration='') {
global $wpdb;
$request = "SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS 'comment_count' FROM $wpdb->posts, $wpdb->comments";
$request .= " WHERE comment_approved = '1' AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = 'publish'";
if(!$show_pass_post) $request .= " AND post_password =''";
if($duration !="") { $request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";
}
$request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";
$posts = $wpdb->get_results($request);
$output = '';
if ($posts) {
foreach ($posts as $post) {
$post_title = stripslashes($post->post_title);
$comment_count = $post->comment_count;
$permalink = get_permalink($post->ID);
$output .= $before . '<a href="' . $permalink . '" title="' . $post_title.'">' . $post_title . '</a> (' . $comment_count.')' . $after;
}
} else {
$output .= $before . "None found" . $after;
}
echo $output;
} ?>
< ?php most_popular_posts(); ?>
</pre>
<p>You can change the number of posts you want to show by change the &#8220;5&#8243; in &#8220;$no_posts = 5&#8243;. Enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://iwp.me/how-to-display-popular-posts-without-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
