<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>WordPress &#8250; Support Topic: [Plugin wp-postviews] fetch most viewed post from a category</title>
<link>http://wordpress.org/support/</link>
<description>WordPress &#8250; Support Topic: [Plugin wp-postviews] fetch most viewed post from a category</description>
<language>en</language>
<pubDate>Tue, 24 Nov 2009 19:04:27 +0000</pubDate>

<item>
<title>kReEsTaL on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-1151968</link>
<pubDate>Sun, 26 Jul 2009 18:27:29 +0000</pubDate>
<dc:creator>kReEsTaL</dc:creator>
<guid isPermaLink="false">1151968@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Hello guys,&#60;/p&#62;
&#60;p&#62;I have the same problem that perfectlover had in the first place. I try to display the most viewed posts and the least viewed posts of a category on the category's template (category-N.php).&#60;/p&#62;
&#60;p&#62;I tried this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php if (function_exists(&#38;#39;get_most_viewed_category&#38;#39;) &#38;amp;&#38;amp; intval(get_query_var(&#38;quot;cat&#38;quot;)) &#38;gt; 0): ?&#38;gt;
&#38;lt;ul&#38;gt;
&#38;lt;?php get_most_viewed_category(get_query_var(&#38;quot;cat&#38;quot;),&#38;#39;both&#38;#39;,10); ?&#38;gt;
&#38;lt;/ul&#38;gt;
&#38;lt;?php endif; ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;but it returns &#34;N/A&#34;.&#60;/p&#62;
&#60;p&#62;After reading Lester Chan's forum (&#60;a href=&#34;http://forums.lesterchan.net/index.php/topic,3096.0.html&#34;&#62;this topic&#60;/a&#62; in particular), I came up with this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
query_posts(&#38;#39;v_sortby=views&#38;amp;v_orderby=asc&#38;#39;);
$recent_posts = new WP_Query(&#38;quot;cat=3&#38;amp;showposts=3&#38;amp;post_status=publish&#38;quot;);
while ($recent_posts-&#38;gt;have_posts()):
$recent_posts-&#38;gt;the_post();?&#38;gt;
&#38;lt;li&#38;gt;&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot; title=&#38;quot;&#38;lt;?php the_title(); ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/a&#38;gt;&#38;lt;span&#38;gt;(&#38;lt;?php the_views() ?&#38;gt; fois)&#38;lt;/span&#38;gt;&#38;lt;/li&#38;gt;
&#38;lt;?php
endwhile;
wp_reset_query();
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Which works fine to display the least viewed posts.&#60;/p&#62;
&#60;p&#62;However, when I replace &#34;asc&#34; by &#34;desc&#34; in the first query line, I get the exact same list, that is to say a list of the LEAST viewed posts, and not the most viewed ones.&#60;/p&#62;
&#60;p&#62;Any idea why sorting posts by &#34;desc&#34; doesn't work?&#60;/p&#62;
&#60;p&#62;The code used to work, though, with 2.7.2. I upgraded to 2.8.2 a few days ago, and it seems the problem appeared at that moment.&#60;/p&#62;
&#60;p&#62;Thanks a lot for your help!
&#60;/p&#62;</description>
</item>
<item>
<title>GamerZ on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-974121</link>
<pubDate>Tue, 03 Feb 2009 01:28:11 +0000</pubDate>
<dc:creator>GamerZ</dc:creator>
<guid isPermaLink="false">974121@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Hi Michael, Thanks so much for the compliments =D
&#60;/p&#62;</description>
</item>
<item>
<title>MichaelH on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-973732</link>
<pubDate>Mon, 02 Feb 2009 18:19:49 +0000</pubDate>
<dc:creator>MichaelH</dc:creator>
<guid isPermaLink="false">973732@http://wordpress.org/support/</guid>
<description>&#60;p&#62;As always, LC, your support of your plugins is superb!  Thanks.
&#60;/p&#62;</description>
</item>
<item>
<title>GamerZ on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-973701</link>
<pubDate>Mon, 02 Feb 2009 17:47:42 +0000</pubDate>
<dc:creator>GamerZ</dc:creator>
<guid isPermaLink="false">973701@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Happen to see this:&#60;br /&#62;
&#60;code&#62;&#38;lt;?php if (function_exists(&#38;#39;get_most_viewed_category&#38;#39;) &#38;#38;&#38;#38; intval(get_query_var(&#38;quot;cat&#38;quot;)) &#38;gt; 0): ?&#38;gt;&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#38;lt;ul&#38;gt;&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#38;lt;?php get_most_viewed_category(get_query_var(&#38;quot;cat&#38;quot;),&#38;#39;both&#38;#39;,10); ?&#38;gt;&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#38;lt;/ul&#38;gt;&#60;/code&#62;&#60;br /&#62;
&#60;code&#62;&#38;lt;?php endif; ?&#38;gt;&#60;/code&#62;&#60;br /&#62;
And it works on the default theme (archive.php). You cannot put it in anywhere except the archive.php because that is the only page where the category information get retrieved.
&#60;/p&#62;</description>
</item>
<item>
<title>MichaelH on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-973677</link>
<pubDate>Mon, 02 Feb 2009 17:27:15 +0000</pubDate>
<dc:creator>MichaelH</dc:creator>
<guid isPermaLink="false">973677@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Posting a resolution to the problem here would be beneficial to others.  Thanks.
&#60;/p&#62;</description>
</item>
<item>
<title>perfectlover on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-973048</link>
<pubDate>Sun, 01 Feb 2009 21:20:49 +0000</pubDate>
<dc:creator>perfectlover</dc:creator>
<guid isPermaLink="false">973048@http://wordpress.org/support/</guid>
<description>&#60;p&#62;It was solved by Gamerz thanks to him.
&#60;/p&#62;</description>
</item>
<item>
<title>MichaelH on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-972119</link>
<pubDate>Sat, 31 Jan 2009 18:42:44 +0000</pubDate>
<dc:creator>MichaelH</dc:creator>
<guid isPermaLink="false">972119@http://wordpress.org/support/</guid>
<description>&#60;p&#62;If you are wanting that displayed on a single.php, then aren't you looking to return the most viewed post from the category of the post being displayed on that single page?&#60;/p&#62;
&#60;p&#62;If so, wouldn't it be something like:&#60;br /&#62;
&#38;lt;?php&#60;br /&#62;
$category = get_the_category();&#60;br /&#62;
if (function_exists('get_most_viewed_category')) {&#60;br /&#62;
get_most_viewed_category($category[0],'both',10);&#60;br /&#62;
}&#60;br /&#62;
?&#38;gt;&#60;br /&#62;
`&#60;/p&#62;
&#60;p&#62;See:&#60;br /&#62;
&#60;a href=&#34;http://codex.wordpress.org/Template_Tags/get_the_category&#34;&#62;Template_Tags/get_the_category&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>perfectlover on "[Plugin wp-postviews] fetch most viewed post from a category"</title>
<link>http://wordpress.org/support/topic/239231#post-971843</link>
<pubDate>Sat, 31 Jan 2009 14:04:33 +0000</pubDate>
<dc:creator>perfectlover</dc:creator>
<guid isPermaLink="false">971843@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Hi,&#60;br /&#62;
Using Gamer'z wp-postviews plugin I am trying to show most viewed post on single page. I want to fetch most viewed post from a categories and display on that page. Gamerz suggested me to use get_query_var(&#34;cat&#34;) and I am using following code on the sidebar.&#60;br /&#62;
&#38;lt;?php if (function_exists('get_most_viewed_category')): ?&#38;gt;&#60;/p&#62;
&#60;ul&#62;
      &#38;lt;?php get_most_viewed_category(get_query_var(&#34;cat&#34;),'both',10); ?&#38;gt;
   &#60;/ul&#62;
&#60;p&#62;&#38;lt;?php endif; ?&#38;gt; &#60;/p&#62;
&#60;p&#62;I am just getting N/A and no posts. Since it is not support question, gamerz can not provide any help and is fair enough. I am wondering if some one has tried this custom modification.&#60;br /&#62;
Thank you.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
