So I went ahead and did the multiple loop thing, as I had done before. I’m always interested in seemingly cleaner/simpler solutions, but sometimes you just have to keep moving. This is the code I’m using:
<?php
$args = array(
'post_type' => 'projects',
'project_category' => 'websites',
'orderby' => 'menu_order',
'showposts' => 1
);
$posts = get_posts( $args );
foreach ($posts as $post) : setup_postdata($post);
?>
// Get the post stuff here
<?php endforeach; wp_reset_postdata(); ?>
I can repeat this as needed, changing the taxonomy (in this case the taxonomy is project_category) term each time.
Please feel free to comment an tell me if this isn’t a good way to do it. I’m far from an expert at the PHP side of WordPress.
Related Posts:
- Custom post types not displaying per category
- how do I group content in magazine-style ‘issues’?
- Alphabetical sorting of custom post type – one letter per page
- List all posts in Custom Post Type but group dynamically by Custom Taxonomies
- How to show related posts by category or custom post type?
- Categories and Tags not working!
- Query Custom Post by Category
- Custom taxonomy template not working with simple loop. Multiple CPT using the same taxonomy
- How to list custom post types?
- Display Next/Prev when looping Custom post-types archive?
- WP_Query | ‘post_type’ doesn’t work
- CPT Archive with core Category
- Custom post type templating problem
- Show a Category X’s custom post type on Category X archive page?
- Custom post type, organized by categories
- WP Query with categories only shows one post and ignores the category
- Custom Post Type Category Link
- Custom Post type category pages template and loop
- Tag page only display 10 posts
- get_terms() parent, child and grandchild
- Use post in multiple places on a page with multiple posts
- Custom Post Type Custom Archive Page Not Working
- Custom post type category permalinks and archive pages
- Show the categories the current post has
- Custom WordPress theme not displaying posts from category
- Pagination for a cpt filtered with a category
- Only show categories that have posts within custom post type
- get_permalink() of page the enclosing page not posts
- Excluding category from loop not working
- How to Show all Values in category.php page using post_type
- Only show current category post
- Help with Multi Level Category Archive Page
- Custom Post Type + Category archive
- How to query all custom posts of a certain type and checking what category they have
- How can I set up the URL for a category archive for a custom post type?
- Categories and page filtering with pre_get_posts
- display all posts in current category
- Show custom post type on post category page doesn’t work / breaks navigation
- Best practice to display a list/archive of Custom Posts in a Page Template
- Categorizing Custom Posts in Bulk Based on Title
- Create side bar widget showing list of years as hyperlinks for a custom post type
- 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
- Custom loop with multiple taxonomy queries
- I would like to have different styles for my posts based on the content of each post
- Separate custom categories from default category
- Checking if Post Title is Unique as Loop Criteria
- Custom post type not displaying content from single-{custom post type} page
- Create template for taxonomy results limited by Custom Post Type
- forming WP_Query for posts of all post types but from specific categories
- How should I structure my post types?
- wp_list_categories() – current-cat class also inside posts?
- Showing posts from different categories and from custom post type
- Custom post type getting wrong categories and tags
- Custom post type multiple loop by taxonomy term
- Extending AZIndex plugin to use custom post types and custom taxonomies
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- List custom taxonomy specific to one custom post type
- How to use has_archive but disable feed per post type?
- Paging doesn’t work?
- Sort by alphabetical order archive.php page
- What is the recommended / best way to do this: Event calendar post/type in a block-based theme?
- Custom post type: Disable single page, but keep archive
- WordPress post_where & posts_join not working only for custom post type
- Custom Tag Description unable to display just below and outside of the Loop
- PHP variable not regenerating when publishing multiple posts at the same time
- Display all taxonomy terms, add class if term applies to current post
- Multiple level category drop-down from the WordPress dashboard
- Return the latest post from a custom Taxonomy and Post Type
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Add custom post type settings to wordress default posts
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Use Custom Post Type archive page for the taxonomies term archive page
- Display custom post type category, while in a CPT category, then the posts beneath
- Hide parent categories when clicked, and show it’s childs
- Limit amount of posts made within a custom taxonomy
- Problem with displaying posts in the CPT category
- Group CPT posts by custom taxonomy
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- Custom Post Types with a common category for a blog listing
- Can’t remove front from permalinks for custom taxonomy category page
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- How to get categories linked in posts for a specific post type
- Best way to style first post differently?
- A to Z List of Custom Post Type in three columns
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- What’s the WP way to load remaining custom posts?
- Remove CPT name from permalink but add %category% instead
- Single post with a Custom Post Type returns 404, when archives of the CPT work correctly
- Set a checkmark in a category based on a URL-parameter
- CPT archive admin menu label
- Number of Custom Post Types published are not being shown in the custom page
- What to and how to proceed with CPT to make DB small and efficient?
- Custom post type archive page blank
- Adding custom post type to count in category
- How to conditionally redirect to the post from a taxonomy page?