You can refer this.
Use the examples part. Inside the foreach loop put your all the code which needs to be repeated for each category type.
something like:
<?php
$categories = get_the_category();
if($categories){
foreach($categories as $category) {
$my_query = new WP_Query('cat=$category->term_id');
//code to display category posts goes here
}
}
?>
You are ready to go with this.
Related Posts:
- Blog post per page setting conflicting with custom WP_Query?
- How to : pagination in 3 different custom loops on the same page
- Getting blog pagination to work on page set as front page
- Numbered Pagination Showing The Same Posts After Altering WP_Query
- Should we trust the post globals?
- The next_posts_link() works only with original $wp_query
- Get first post from wp_query
- WP_Query: Why is sticky post not first item in loop?
- Query *only* sticky posts
- Skipping first 3 posts in wp query
- How do I reorder (pop and push) items from WP_Query?
- How to exclude latest x posts from a paginated query?
- Reverse chronology of post listing
- WordPress Number of Posts Not Changing With posts_per_page
- Pagination not working on Custom Page Template
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Specific loop in Shortcode
- Search widget breaks when using multiple loops?
- Display posts with comments closed, with pagination?
- Group posts by year in loop
- How would I get 1 latest post from a query for 5 posts?
- Lazy Load using WP_Query pagination
- Loop through all product posts?
- How to display different number of posts
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- WP Query – duplicated posts once including tags in search results
- Display post from current category and same tag?
- Why WP_Query(‘showposts=5’) shows only 1 post?
- How to exclude latest x posts from a paginated query?
- Blog page pagination is not working after using the offset argument
- WP Query – Posts Per Page not working in combination with category__in
- Pausing and Resuming WP_Query results
- Pagination with an array of post objects?
- How safe is renovating $wp_query when doing WP_Query pagination in Page Template
- Start WP Pagination From Number 1 in URL
- List authors with the last post title and order by last post date
- Use two different post_per_page limits with infinite scroll
- wp_query random post
- Possible to alternate between two loops
- Why are my paginated posts always returning the same results?
- How to get posts published on the latest date?
- Page and post loop same template
- Display current post position in Elementor Posts widget
- WP_Query: Show 10 posts in date order, first three random
- WordPress Loop: How to display recent posts in multiple divs
- How to display post list in a table layout (multiple queries in single loop)
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Custom WP_Query not working correctly
- WP_Query of Category Not Showing First Post
- Display 3 posts with different HTML markup using a loop
- Pagination for normal (standard) posts on a page with a custom loop?
- While loop in functions.php outputting the_title() of each post on frontpage
- Manipulated offset and pagination, can’t display last post anymore
- Display specific posts based on an ID of another post
- show loop id post , only first id can read
- How can I get the last post while on the first post for pagination? As if it were infinite
- Double loop output
- Override wp_link_pages pagebreak with filter
- Loop through all posts showing duplicates
- Can I Paginate Post after every 25 tag?
- Wp_query loop is not working as it should
- Posts are not showing up on next page.
- WordPress loop uses unmodified posts array, why?
- Advanced Post Display/Pagination/Ordering
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- How to show the posts list into a static page? Problems to use the loop into a static page
- Pagination for custom query won’t let me back on page 1
- Adding a category at even positions on main loop with modified pagination
- Make assigning post to a specific category equivalent to assigning it to all categories
- Can’t get pagination to work
- How to inject a post within a loop
- The next_posts_link() works only with original $wp_query
- WordPress posts loop pagination – first page return 125 posts instead of 10 and the rest return 10
- Limit amount of pages shown in pagination within wp_query
- How do I show the post title if an advanced custom field hasn’t been used?
- First post in loop displays twice
- posts_per_page – Repeats only first posts ‘post__in’ array
- query_posts different amount of posts per page [duplicate]
- How to show list of posts by author and category?
- Exclude drafts in all() view of edit.php
- How to Display Post View Count
- Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?
- Automatic post deletion
- Five posts from a category in footer
- Adding specific post category between posts in loop
- How can I show many posts an author has per week?
- Ajaxify This Code
- 301 (static page instead latest posts)
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- Conflict array_splice on loop and query in widget
- How come this loop is not working? [closed]
- How to create loop of posts except post ID defined via ACF field
- Displaying a specific sub-category’s posts from wp_query
- Custom layout manager for posts
- Get results from the main wp_query
- WordPress Numeric Pagination with Query String [duplicate]
- How to get single post by one author?
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- Wp_query WooCommerce products