If you are after on post from category a, one from category b, another form category c and then finally a custom post type – each of these would have to be a separate query.
Think of these as ‘secondary queries’ – (the primary query being what lands you on the home page). So you’ll want use seperate instances of WP_Query
(see this related post).
E.g.
$post_from_cat_a = new WP_Query(array(
'category__name' => array('a'),
'posts_per_page'=> 1
));
if( $post_from_cat_a->have_posts() ){
while( $post_from_cat_a->have_posts() ): $post_from_cat_a->the_post();
//Display output here
endwhile;
}
$post_from_cat_b = new WP_Query(array(
'category__name' => array('b'),
'posts_per_page'=> 1
));
if( $post_from_cat_b->have_posts() ){
...
...
etc. Don’t forget to call wp_reset_postdata();
at the end.
Related Posts:
- How to show all posts of the category in wordpress?
- Get category id from post id of a custom post type
- How to show related posts by category or custom post type?
- Structuring a product catalogue in WordPress [closed]
- Displaying custom post type on category pages but not on blog listings
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- How to get the post type from a category id?
- Getting posts under the custom post type ui category
- Show custom post type filtered by category
- Add custom post type settings to wordress default posts
- Problem with displaying posts in the CPT category
- Set a checkmark in a category based on a URL-parameter
- Get the category from custom post type
- Custom Post Slug same as Parents Category Slug
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- How can I show 1 featured post in a styled element, and the next few below differently styled
- WP the_posts() on single-cars.php get category link
- Create new custom post and post category of same name
- Custom post types and ‘new WP_Query’
- How to Display Posts From Category Within a Custom Taxonomy?
- Showing custom post type categories in the menu
- Stores category posts in an array
- Restrict category access to specific users/groups. Author always has access
- Post Query not working
- Use post in multiple places on a page with multiple posts
- Am I mixing up the concept of posts pages and categories?
- Display all Categories except ones with a specific parent
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- Post category behave like a Post in back office menu
- Save data is post using php front end
- How to show posts of the same category on a page?
- How to manage a dynamic multi-level page hierearchy system?
- Custom Post By Category
- Change Custom Post Type to Post + Category
- Only show current category post
- Post Editor: display categories from current post type taxonomy only?
- Problem to show custom post type in archive page category wise
- Custom Post Type used for FAQs Accordion
- Display all post types together
- show only one category posts in admin
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Display posts of only a certain category in WP Admin section?
- How to detect filter in URL in Category page?
- Set menu active state for custom posttype and category, given custom taxonomy term
- How to show CPTs in term archive
- How to create custom boxes with text inside?
- How to change post featured image using a custom field of category?
- How to add post_type=value when editing that post type in the WordPress admin?
- Change archive page template using pre_get_post
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- CPT Archive with core Category
- Open Custom Post Type as PDF
- Using The REST API How To Pull All Custom Posts?
- Group posts by custom post type
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- Display all posts in main category and 1 subcategory
- Replace li Items with divs with classes
- showing custom post types of a certain category only
- Get posts from a custom post type by child categories of a parent category
- Linking to the most recent post in a Custom Post Type
- Custom Post Type Archive Page Filtering
- Show the same Article Available in Other Categories
- Show category ID on custom post type
- How to modify archive query with pre_get_posts to append CPTs?
- How can I auto-assign a CPT post to category in a custom taxonomy when published?
- Storing posts from query and accessing later via AJAX call
- If post has custom field then display css-class
- get_posts() with custom post type does not work outside page.php
- Posts from all the categories are being displayed instead of particular category
- Display only one post each WEEK
- Get parent categories of custom post type
- Advanced or not so advanced pre_get_posts query
- List children on child post
- Restrict custom post type from appearing with ?post_types=
- How to query_post custom posts within default taxonomy?
- Conditional Statement custom post type category
- Custom Post Type With Categories
- create parent post using wp_insert_post
- Display posts from Custom Post Type in category page on front-end
- Turn on and off custom post type from admin?
- Missing Posts in Custom Taxonomy List
- Multiple meta_values in the pre_get_posts filter?
- Display random posts, but omit the post it is on?
- Categories sorting
- How can I make my custom posts appear in their assigned category url?
- How to call in Custom Post-Type Categories?
- Allow user to set custom order to a list of custom taxonomies?
- get_category_parents for custom post type taxonomy
- How do I do this with WordPress? Taxonomies?
- Disable block with taxonomies at post page
- I would like to have different styles for my posts based on the content of each post
- Separate custom categories from default category
- How can i add thumbnails images to particular post (using code not admin pannel) in wordpress
- forming WP_Query for posts of all post types but from specific categories
- wp_list_categories() – current-cat class also inside posts?
- Custom post type search using $_SESSION and pre_get_posts
- Get latest 3 posts from multiple CPT in one query
- Custom post type getting wrong categories and tags
- Allow non-logged in users to see a future post after clicking on a list of future posts