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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -