[wp-hackers] Pull Latest Post from Each of 6 Categories

Mike Schinkel mikeschinkel at newclarity.net
Mon May 4 22:03:26 GMT 2009


You are probably going to need to use "posts_where" and "posts_join"  
hooks.  Definitely not ideal, but since WP_Query() unfortunately  
doesn't handle that level of complexity, that's what you'll need.  Are  
you familiar with how to build that query in SQL?

-Mike Schinkel
WordPress Custom Plugins
http://mikeschinkel.com/custom-wordpress-plugins/




On May 4, 2009, at 5:42 PM, Nathan Rice wrote:

> I was wondering if there are any WP_Query hackers out there who  
> might be
> able to help me achieve what I'm looking to achieve here.
>
> I have a site which has a section on the homepage that pulls the  
> latest post
> from each of 6 different categories.  As of now, I'm running 6  
> separate
> instances of WP_Query to get the latest post from each of the 6  
> categories.
>
> I would very much like to reduce this down to only a single query, if
> possible.
>
> Is there any combination of parameters I can pass to "new WP_Query"  
> in order
> to get it to return the latest post from each of the 6 categories.
>
> If so, that would be awesome.
>
> Thanks!
> Nathan
>
> My Website
> http://www.nathanrice.net/
>
> My Twitter
> http://twitter.com/nathanrice
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list