Can I get a specific number of posts per author and order by date in Wordpress? -
i have pretty basic query_posts call:
query_posts(array(cat=>3,author=>$userid,posts_per_page=>12))
this getting 12 posts third category set of authors. piece i'm missing want 12 made of 2 posts each of 6 authors. order date fine, don't need grouped author.
is there way pull posts way?
i wrong, don't think possible 1 query since there isn't (to knowledge) way specify how many posts per author.
it add load time little bit, might have split out 6 different queries work.
you can using wp_query (your shouldn't use query_posts
change main query) , wrapping each query in specific author block:
$author1 = new wp_query(array('cat'=>3,'author'=>$author1id,'posts_per_page'=>12)); if($author1->have_posts): while($author1->have_posts()): $author1->the_post(); ?> <!--insert html etc. here--> <?php endwhile; endif; wp_reset_query(); //reset query object if running in loop
then each of other authors , should trick.
hope helps. if there way 1 query know since multiple queries can slow down page load.
Comments
Post a Comment