You can go with two queries, the first to get your taxonomies like this :
$categories = get_categories();
More infos about the params here.
And then browse your category collections and get the first n posts of it like this :
foreach($categories as $cat)
{
//get the $n posts from this category
$post_query = new WP_Query(
array('post_type' => 'post',
'posts_per_page' => $n ,
'tax_query' => array(
array(
'taxonomy' => $cat->taxonomy,
'field' => 'slug',
'terms' => $cat->term_id,
)
)
)
);
echo '<h2>'.$cat->name.'</h2>';
while($post_query->have_posts()){
$post_query->the_post();
echo get_the_title();
}wp_reset_query();
}
Hope it will help =)
Related Posts:
- Get the children of the parent category
- How to check if I’m on the last page of posts?
- Should category.php and The Loop be used if the query needs to be customizable?
- Exclude the category from the WordPress loop
- get_field not displaying my custom field value
- Randomise results from a category page?
- Display all posts in category, with specific tag posts at top
- Show div only if post is in specific category
- How to show a category post to a specific registered user
- Loop with Dynamic Categories
- How can I create a loop to build slides based on multiple categories using Coda Slider
- Categories list loop – add separator every year
- How would you create a “weekly” archive?
- How to exclude categories from recent posts, recent comments & category widgets?
- Listing all posts from current category on page
- Display one latest post from multiple categories
- How do I get the total number of categories in a list of search results?
- Display products for a category, sorted by post_excerpt
- Listing Parent, Child and GrandChild Categories and then the PostTitles on Page Template !
- a-z list, categories and sub categories in loop
- Why would in_category only return one post in a specific category?
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- Additional featured post on first page
- Show all posts for a specific category/author
- create a page which displays a list of categories title+ short description?
- Query Posts Exclude Entire Category
- Class active for Archive link – looped out
- Taxonomy name repeating when showing 2 posts from each category
- Display the last post by each category?
- Counter in loop in foreach
- How to exclude the last post from a category(featured for example) from the main loop?
- Order by category titles
- ajax for filtering posts by category in wordpress loops
- Inside a loop, how to change CSS class based on category name?
- Categories list loop – add separator every 3 categories [closed]
- Limit get_categories to show each category once
- Display single category name in woocommerce loop
- Show Posts from Single Category Not Working
- Is there a reason I cannot get the current category in a loop?
- Category archive is displaying all posts rather than the specific category
- new WP_Query all post in a category inside the loop
- Trying to get variables in hacked category dropdown
- How to add orderby parameter for sorting on category.php
- category__not_in and id values from variable
- How to loop custom post_type from (a) specific category(ies)?
- Do not show sub categories in the loop on archive-product.php
- How to display the parent category if only the child category has been chosen
- Category tags with comma’s
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Getting the Most Recent Posts from Multiple Categories
- Display subcategories in dropdown
- Display category title and three latest post inside the category
- More efficient way to list posts by category [duplicate]
- Category nicename inside loop in wordpress
- Show multiple categories in query using redux framework variable
- filter a loop base on specific category
- Limit Loop to One Category
- Filter Category Loop Dynamically
- Editing Loop So It Targets Specific Tags?
- the_category() doesn’t working in wp_query loop
- Conditional category query breaking?
- Problem: retrieving parent category’s first post
- Posts made to category don’t show up (do show up on frontpage)
- Category name for all posts getting assigned to a single random post
- Category post count is not correct
- Display all categories but only if they have posts in them that have a specific tag assigned
- Include last post date in get_categories loop
- How can I order all subcategories alphabetical independent of the parent categories?
- How to get specific (grand parent) category of current post?
- Custom Loop with certain number of one category
- how tho change number of posts in loop from specific categories
- Template category.php with page (no posts)
- error in specific category loop
- loop in single.php of the same category
- Please tell how to stop the category from showing up on posts
- Hide a category/posts from the homepage in wp
- Assign a class to first element in category in loop
- Querying posts from two different categories while looping inside another loop
- Trying to display all posts in a category
- Category page shows only 1 post when that post has more than 1 category?
- Loop doesn’t work
- Configure query with multiple categories in a custom order?
- Display Taxonomies in loop with template args
- How to loop through a custom field for each post, & display?
- How can I modify this code to iterate over an array of categories?
- How to exclude a specific categogy from a custom page template
- How to get multiple loop in category.php, my scripts becomes madness
- Printing direct descendants of a category with WP_Query
- Custom Category Page Not Working [duplicate]
- My Query is getting the wrong data
- How do i add custom post types to this query?
- Custom loop by url
- Custom WordPress category page showing all posts rather than the specified category
- How do I hide posts in a category from all listings but still allow the posts to be viewed?
- Do not show all post from all categories, just show posts from category in current loop
- IF have_posts contains posts from a certain category
- Echo Category In Loop