<?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: Latest post per category, from category 1 -8 on homepage</title>
<link>http://wordpress.org/support/</link>
<description>WordPress &#8250; Support Topic: Latest post per category, from category 1 -8 on homepage</description>
<language>en</language>
<pubDate>Thu, 26 Nov 2009 01:42:34 +0000</pubDate>

<item>
<title>kirmann on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1171962</link>
<pubDate>Wed, 12 Aug 2009 04:51:39 +0000</pubDate>
<dc:creator>kirmann</dc:creator>
<guid isPermaLink="false">1171962@http://wordpress.org/support/</guid>
<description>&#60;p&#62;continue of the topic.&#60;/p&#62;
&#60;p&#62;case : we wanna split the first post (one category) with the second post or next post. And the next post is only two post.&#60;/p&#62;
&#60;p&#62;question : How the query to do it ?&#60;/p&#62;
&#60;p&#62;Thanks, before
&#60;/p&#62;</description>
</item>
<item>
<title>MAD000 on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1171182</link>
<pubDate>Tue, 11 Aug 2009 16:45:42 +0000</pubDate>
<dc:creator>MAD000</dc:creator>
<guid isPermaLink="false">1171182@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Hi all,&#60;br /&#62;
I have been trying to find a simpler, more efficient way to display different posts depending on different conditions. For now I wrote the following script to retrieve posts for a specific category named 'Inspiration' and that should be displayed in descending order based on the number of comments (popularity). I would welcome any suggestions to shorten this (I feel there is another way!!)&#60;br /&#62;
here is the code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;div class=&#38;quot;inspirational-post-box&#38;quot;&#38;gt;&#38;lt;!-- start --&#38;gt;
&#38;lt;h1 class=&#38;quot;heading-small&#38;quot;&#38;gt;Inspirational Posts&#38;lt;/h1&#38;gt;
&#38;lt;?php $sql = &#38;quot;SELECT * &#38;quot;
	. &#38;quot;FROM $wpdb-&#38;gt;posts AS p &#38;quot;
	. &#38;quot;WHERE p.post_status = &#38;#39;publish&#38;#39; &#38;quot;
	. &#38;quot;AND p.post_type = &#38;#39;post&#38;#39; &#38;quot;
	. &#38;quot;AND p.ID IN (SELECT tr.object_id &#38;quot;
	. &#38;quot;FROM $wpdb-&#38;gt;term_relationships tr &#38;quot;
	. &#38;quot;WHERE tr.term_taxonomy_id IN (SELECT tt.term_taxonomy_id FROM wp_term_taxonomy AS tt &#38;quot;
	. &#38;quot;INNER JOIN $wpdb-&#38;gt;terms AS t ON t.term_id = tt.term_id &#38;quot;
	. &#38;quot;WHERE (tt.term_id = (SELECT tt.term_taxonomy_id &#38;quot;
	. &#38;quot;FROM $wpdb-&#38;gt;term_taxonomy AS tt &#38;quot;
	. &#38;quot;INNER JOIN $wpdb-&#38;gt;terms AS t ON tt.term_id = t.term_id &#38;quot;
	. &#38;quot;WHERE tt.taxonomy = &#38;#39;category&#38;#39; AND t.name = &#38;#39;Inspiration&#38;#39;) OR tt.parent = (SELECT tt.term_taxonomy_id &#38;quot;
	. &#38;quot;FROM $wpdb-&#38;gt;term_taxonomy AS tt &#38;quot;
	. &#38;quot;INNER JOIN $wpdb-&#38;gt;terms AS t ON tt.term_id = t.term_id &#38;quot;
	. &#38;quot;WHERE tt.taxonomy = &#38;#39;category&#38;#39; AND t.name = &#38;#39;Inspiration&#38;#39;)))) &#38;quot;
	. &#38;quot;ORDER BY p.comment_count DESC LIMIT 12&#38;quot;;
$result = $wpdb-&#38;gt;get_results($sql);
foreach ($result as $post) {
setup_postdata($post);
?&#38;gt;
&#38;lt;div class=&#38;quot;entry-small&#38;quot;&#38;gt;
&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot; rel=&#38;quot;bookmark&#38;quot; title=&#38;quot;Permanent Link to &#38;lt;?php the_title_attribute(); ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;img class=&#38;quot;thumbnail-small&#38;quot; src=&#38;quot;&#38;lt;?php bloginfo(&#38;#39;template_url&#38;#39;) ?&#38;gt;/images/&#38;lt;?php echo get_post_meta($post-&#38;gt;ID, &#38;#39;post-thumbnail&#38;#39;, true); ?&#38;gt;&#38;quot; width=&#38;quot;50&#38;quot; height=&#38;quot;50&#38;quot; alt=&#38;quot;Small Thumbnail&#38;quot; /&#38;gt;&#38;lt;/a&#38;gt;
&#38;lt;h2 class=&#38;quot;title-small&#38;quot;&#38;gt;
&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot; rel=&#38;quot;bookmark&#38;quot; title=&#38;quot;Permanent Link to &#38;lt;?php the_title_attribute(); ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#38;lt;/a&#38;gt;
&#38;lt;/h2&#38;gt;
&#38;lt;/div&#38;gt;
&#38;lt;?php } ?&#38;gt;
&#38;lt;/div&#38;gt;&#38;lt;!-- end --&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;[&#60;strong&#62;signature moderated&#60;/strong&#62;  Please read the &#60;a href=&#34;http://wordpress.org/support/topic/68664?replies=6&#34;&#62;Forum Rules&#60;/a&#62;]
&#60;/p&#62;</description>
</item>
<item>
<title>funkboybilly on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1163459</link>
<pubDate>Wed, 05 Aug 2009 04:13:45 +0000</pubDate>
<dc:creator>funkboybilly</dc:creator>
<guid isPermaLink="false">1163459@http://wordpress.org/support/</guid>
<description>&#60;p&#62;sorry, I posted wrong info...
&#60;/p&#62;</description>
</item>
<item>
<title>Rocksijen on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1155587</link>
<pubDate>Wed, 29 Jul 2009 18:02:08 +0000</pubDate>
<dc:creator>Rocksijen</dc:creator>
<guid isPermaLink="false">1155587@http://wordpress.org/support/</guid>
<description>&#60;p&#62;ohhhhhh !&#60;br /&#62;
thanks! i am very very hapy!
&#60;/p&#62;</description>
</item>
<item>
<title>digitalrenewal on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1113930</link>
<pubDate>Tue, 23 Jun 2009 17:18:20 +0000</pubDate>
<dc:creator>digitalrenewal</dc:creator>
<guid isPermaLink="false">1113930@http://wordpress.org/support/</guid>
<description>&#60;p&#62;thank you tgiokdi!!! ive been trying to figure this out for 2 days. i knew it had to be simple, it built right into worpdress 2.8, but i couldnt get anyones code to work. :) im cartwheel happy!
&#60;/p&#62;</description>
</item>
<item>
<title>t31os on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1021319</link>
<pubDate>Fri, 20 Mar 2009 13:33:27 +0000</pubDate>
<dc:creator>t31os</dc:creator>
<guid isPermaLink="false">1021319@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Not sure if this be of use to any of you guys, but i made a function for looping through categories and posts...&#60;/p&#62;
&#60;p&#62;Accepts categories as an array...&#60;/p&#62;
&#60;p&#62;See here if of use..&#60;br /&#62;
&#60;a href=&#34;http://www.t31os.co.uk/wordpress-catx/&#34; rel=&#34;nofollow&#34;&#62;http://www.t31os.co.uk/wordpress-catx/&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>pesocky on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1020812</link>
<pubDate>Thu, 19 Mar 2009 23:16:58 +0000</pubDate>
<dc:creator>pesocky</dc:creator>
<guid isPermaLink="false">1020812@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Thanks! I fixed same error.
&#60;/p&#62;</description>
</item>
<item>
<title>c64glen on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1006175</link>
<pubDate>Thu, 05 Mar 2009 11:45:29 +0000</pubDate>
<dc:creator>c64glen</dc:creator>
<guid isPermaLink="false">1006175@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Thanks, I actually fixed my problem (after many many hours) by replacing &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;query_posts($query);
    while (have_posts()) : the_post();&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;with&#60;/p&#62;
&#60;p&#62;	 `&#60;br /&#62;
$recent = new WP_Query($query); while($recent-&#38;gt;have_posts()) : $recent-&#38;gt;the_post();&#60;br /&#62;
`
&#60;/p&#62;</description>
</item>
<item>
<title>davesgonebananas on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1005747</link>
<pubDate>Thu, 05 Mar 2009 00:17:45 +0000</pubDate>
<dc:creator>davesgonebananas</dc:creator>
<guid isPermaLink="false">1005747@http://wordpress.org/support/</guid>
<description>&#60;p&#62;When you use query_posts in the sidebar you are overwriting the main query that contains the posts for the page you are on!&#60;/p&#62;
&#60;p&#62;I think you can use &#60;strong&#62;wp_reset_query()&#60;/strong&#62; after the loop in the sidebar to get round this.
&#60;/p&#62;</description>
</item>
<item>
<title>c64glen on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-1005666</link>
<pubDate>Wed, 04 Mar 2009 22:15:20 +0000</pubDate>
<dc:creator>c64glen</dc:creator>
<guid isPermaLink="false">1005666@http://wordpress.org/support/</guid>
<description>&#60;p&#62;I'm current having the same problem (so I hope you don't mind me tagging this along) &#60;/p&#62;
&#60;p&#62;The following bit of code display the latest post in six selected categories in my side bar.  (excuse the code it's a little messy)&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
for ($i = 1; $i &#38;lt;= 6; $i++) {
if ($i==1) {$oi_cat = &#38;quot;article&#38;quot;;}
if ($i==2) {$oi_cat = &#38;quot;music&#38;quot;;}
if ($i==3) {$oi_cat = &#38;quot;video&#38;quot;;}
if ($i==4) {$oi_cat = &#38;quot;podcasts&#38;quot;;}
if ($i==5) {$oi_cat = &#38;quot;blog&#38;quot;;}
if ($i==6) {$oi_cat = &#38;quot;links&#38;quot;;}

?&#38;gt;
&#38;lt;div class=&#38;quot;spoiler clearfloat&#38;quot;&#38;gt; &#38;lt;IMG src=&#38;quot;&#38;lt;?php bloginfo(&#38;#39;stylesheet_directory&#38;#39;); ?&#38;gt;/images/t-&#38;lt;? echo $oi_cat;?&#38;gt;.png&#38;quot; alt=&#38;quot;&#38;lt;? echo $oi_cat;?&#38;gt;&#38;quot; width=&#38;quot;300&#38;quot; height=&#38;quot;32&#38;quot; style=&#38;quot;margin:0px; padding:0px;&#38;quot;&#38;gt;
    &#38;lt;?php
	 $query= &#38;#39;category_name=&#38;#39;.$oi_cat.&#38;#39;&#38;#38;showposts=1&#38;#39;;
	 query_posts($query);
	?&#38;gt;
    &#38;lt;?php while (have_posts()) : the_post(); ?&#38;gt;
    &#38;lt;div class=&#38;quot;clearfloat&#38;quot;&#38;gt;
      &#38;lt;h4 class=&#38;quot;title&#38;quot;&#38;gt;&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot;&#38;gt;
        &#38;lt;?php the_title(); ?&#38;gt;
        &#38;lt;/a&#38;gt;&#38;lt;/h4&#38;gt;
      &#38;lt;?
    $thumb = get_post_meta($post-&#38;gt;ID, &#38;quot;thumb&#38;quot;, true);
if ($thumb != &#38;quot;&#38;quot;)
{ ?&#38;gt;
      &#38;lt;img src=&#38;quot;&#38;lt;?php $values = get_post_custom_values(&#38;quot;thumb&#38;quot;); echo $values[0]; ?&#38;gt;&#38;quot;&#38;quot; alt=&#38;quot;&#38;lt;?php the_title(); ?&#38;gt;&#38;quot; width=&#38;quot;80&#38;quot; height=&#38;quot;80&#38;quot; align=&#38;quot;left&#38;quot; class=&#38;quot;left&#38;quot; id=&#38;quot;spoiler&#38;quot; /&#38;gt;
      &#38;lt;?php }
  the_excerpt();  endwhile;?&#38;gt;
      &#38;lt;div class=&#38;quot;right&#38;quot;&#38;gt;&#38;lt;a href=&#38;quot;/category/&#38;lt;? echo $oi_cat;?&#38;gt;/&#38;quot;&#38;gt;More &#38;lt;? echo $oi_cat;?&#38;gt; &#38;amp;raquo;&#38;lt;/a&#38;gt;&#38;lt;/div&#38;gt;
      &#38;lt;br /&#38;gt;
    &#38;lt;/div&#38;gt;
  &#38;lt;/div&#38;gt;
  &#38;lt;?

  }
  ?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;If I attempt to view my blog via the front page &#34;/&#34; or via a blog post &#34;/blog post name/&#34; I get a blank page. However if I view this on a category page e.g. &#34;/category/article/&#34; it works fine.&#60;/p&#62;
&#60;p&#62;any ideas why?
&#60;/p&#62;</description>
</item>
<item>
<title>Dreamsinplay on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-997137</link>
<pubDate>Tue, 24 Feb 2009 23:40:40 +0000</pubDate>
<dc:creator>Dreamsinplay</dc:creator>
<guid isPermaLink="false">997137@http://wordpress.org/support/</guid>
<description>&#60;p&#62;I am seeking to have my website updated ASAP, but due to the fact that I am a college student trying to start a non-profit organization I have a very limited budget.&#60;/p&#62;
&#60;p&#62;My current website is at &#60;a href=&#34;http://www.dreamsinplay.org&#34; rel=&#34;nofollow&#34;&#62;http://www.dreamsinplay.org&#60;/a&#62; and uses Wordpress.&#60;/p&#62;
&#60;p&#62;We are a very recently founded nonprofit organization which seeks to connect socially beneficial dreams with efficient and productive resources.  In order to seek out the best “ideas”, we are seeking to enable our website to allow members to post ideas where other members will read, rate, and comment on them.  With this complete, we will seek out the best ideas, and connect them to the necessary resources.  I would like this part to replicate &#60;a href=&#34;http://wordpress.org/extend/ideas&#34; rel=&#34;nofollow&#34;&#62;http://wordpress.org/extend/ideas&#60;/a&#62; with the titles of the post on the left and the ratings on the right.  You will not be able to rate the idea from the listings, and must go to the ideas’ post to rate and comment.&#60;/p&#62;
&#60;p&#62;Currently, I have a wordpress plugin that allows registered members to submit posts.  What I am looking now for is someone to help me create the ideas page with the titles on the left and the ratings on the right.&#60;/p&#62;
&#60;p&#62;I believe this should be a very quick and easy project, but haven’t been able to do it.  I am very willing to do it myself, if someone could guide me.  Again, I just need something that looks like this: &#60;a href=&#34;http://wordpress.org/extend/ideas&#34; rel=&#34;nofollow&#34;&#62;http://wordpress.org/extend/ideas&#60;/a&#62; &#60;/p&#62;
&#60;p&#62;Furthermore, I would like to be able to do Idea Categories, such as weekly contest, monthly contest, etc. if someone has any suggestions about this.&#60;/p&#62;
&#60;p&#62;Thanks in advance for your time and consideration!&#60;/p&#62;
&#60;p&#62;Sincerely,&#60;br /&#62;
Andrew CP Kelley
&#60;/p&#62;</description>
</item>
<item>
<title>nando99 on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-985495</link>
<pubDate>Fri, 13 Feb 2009 20:49:05 +0000</pubDate>
<dc:creator>nando99</dc:creator>
<guid isPermaLink="false">985495@http://wordpress.org/support/</guid>
<description>&#60;p&#62;just wanted to say that I tried what &#60;strong&#62;tgiokdi&#60;/strong&#62; said and it worked GREAT!!&#60;/p&#62;
&#60;p&#62;thanks
&#60;/p&#62;</description>
</item>
<item>
<title>Dgold on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-929268</link>
<pubDate>Thu, 18 Dec 2008 00:54:44 +0000</pubDate>
<dc:creator>Dgold</dc:creator>
<guid isPermaLink="false">929268@http://wordpress.org/support/</guid>
<description>&#60;p&#62;This page kind of tells you how to do it,&#60;br /&#62;
&#60;a href=&#34;http://codex.wordpress.org/Function_Reference/WP_Query&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Function_Reference/WP_Query&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Unfortunately the way it's written is kind of difficult to understand
&#60;/p&#62;</description>
</item>
<item>
<title>tgiokdi on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-929257</link>
<pubDate>Thu, 18 Dec 2008 00:34:55 +0000</pubDate>
<dc:creator>tgiokdi</dc:creator>
<guid isPermaLink="false">929257@http://wordpress.org/support/</guid>
<description>&#60;p&#62;You may want to do what I did on &#60;a href=&#34;http://www.startrekbookclub.com&#34;&#62;http://www.startrekbookclub.com&#60;/a&#62; with the &#60;a href=&#34;http://codex.wordpress.org/Template_Tags/query_posts&#34;&#62;query posts&#60;/a&#62; bit of code: &#60;/p&#62;
&#60;p&#62;'&#60;br /&#62;
&#38;lt;?php query_posts('orderby=name&#38;#38;order=asc&#38;#38;cat=43&#38;#38;showposts=100'); ?&#38;gt;&#60;/p&#62;
&#60;p&#62;  &#38;lt;?php while (have_posts()) : the_post(); ?&#38;gt;&#60;br /&#62;
&#60;a&#62;&#34;&#38;gt;&#38;lt;?php the_title(); ?&#38;gt;&#60;/a&#62;&#60;br /&#62;
  &#38;lt;?php endwhile;?&#38;gt;&#60;br /&#62;
'&#60;br /&#62;
This code will only show the titles of the posts, but you can use the content or the excerpt with it too to have some lead in text to the articles.&#60;/p&#62;
&#60;p&#62;I'm also using some code to show the children of a specific category:&#60;br /&#62;
'&#60;br /&#62;
&#38;lt;?php wp_list_categories('title_li=&#38;#38;orderby=name&#38;#38;order=asc&#38;#38;child_of=8'); ?&#38;gt;&#60;br /&#62;
'&#60;/p&#62;
&#60;p&#62;my first time trying to past code into these forums so I apologize if this post ends up looking like carp.  Which is a fish, just FYI.
&#60;/p&#62;</description>
</item>
<item>
<title>KevinPaquet on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-920603</link>
<pubDate>Thu, 11 Dec 2008 13:46:25 +0000</pubDate>
<dc:creator>KevinPaquet</dc:creator>
<guid isPermaLink="false">920603@http://wordpress.org/support/</guid>
<description>&#60;p&#62;You're using a WordPress Magazine style theme, right?
&#60;/p&#62;</description>
</item>
<item>
<title>netbuddy34 on "Latest post per category, from category 1 -8 on homepage"</title>
<link>http://wordpress.org/support/topic/222993#post-916699</link>
<pubDate>Sat, 06 Dec 2008 23:55:06 +0000</pubDate>
<dc:creator>netbuddy34</dc:creator>
<guid isPermaLink="false">916699@http://wordpress.org/support/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;Im trying to figure out how i could possibly have the latest post for each category listed on my homepage.&#60;/p&#62;
&#60;p&#62;I have say 8 boxes, for 8 differant categories.&#60;/p&#62;
&#60;p&#62;I would like to display the latest post for each of those categories in a specific order, not name or ID, i need to be able to set the order in a custom way.&#60;/p&#62;
&#60;p&#62;Is this possible without having a bunch of seperate loops? I could probably have 8 IF statements, but im wondering if there is something more compact?
&#60;/p&#62;</description>
</item>

</channel>
</rss>
