<?php $args = array( 'post_type' => 'cars' ); // How can I add a category-filter to this?
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'Car-Types',
'field' => 'slug',
'terms' => 'Audi'
)
)
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<li>';
the_title('<h3>', '</h3>');
the_content();
echo '</li>';
endwhile; ?>
http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
Related Posts:
- Template tags to display custom post type posts in category template?
- Custom templates for a specific category
- Creating Sections for Post Types
- How to get the current category with custom posts
- Archive Template being used instead of Category Template for Custom Post Type
- Having some trouble properly displaying Custom Post Types in templates
- Choose custom post type template by category
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Getting template_include to work when allow_url_include is off?
- Show a Category X’s custom post type on Category X archive page?
- Custom post type content using custom fields without template
- PHP variable not regenerating when publishing multiple posts at the same time
- 2 Templates 1 custom post type according url
- Multiple level category drop-down from the WordPress dashboard
- 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
- 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
- Filter CPT posts by one or more categories
- Custom taxonomy and custom post type – wrong permalinks and template
- 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
- How to get categories linked in posts for a specific post type
- Can I override a CPT template on a per post basis with Gutenberg block editor?
- Custom post type, organized by categories
- How to display “Category and Post_tag” component in a CPT Gutenberg edit screen?
- Remove CPT name from permalink but add %category% instead
- Set a checkmark in a category based on a URL-parameter
- WP Query with categories only shows one post and ignores the category
- Content vs Template on custom post
- Adding custom post type to count in category
- How to edit this code to get the categories in achieve page?
- Category with post type pagination returns 404
- Custom Post Type and Category Base Rewrite Issue
- Get the category from custom post type
- Post injections into Site Origins Page builder [closed]
- Custom Post Type + Categories
- How to use custom template files in deeper directory?
- How to create a gallery page with categories?
- WordPress Doesn’t Generate Taxonomy Archive
- Custom Post Slug same as Parents Category Slug
- WordPress posts page for customer filtering and sorting along with category filter
- A case for Hierarchical Custom Posts
- I am having Trouble to get list of Categories of Custom post Type
- Hierarchy and access control for Custom Post Types (CPT)
- Multiple (two) category postings on the same page.
- Loop filtering Custom Post Types and/or Categories
- School & class blogs: Categorize with categories or custom posts?
- Custom post type and category link together
- Custom taxonomy returns 404
- Why is my category template ignoring post type?
- Best method to make posts searchable, sortable and filterable – custom field, tag or category?
- How to get custom posts sub category link
- Not sure if I should create multiple custom post type [closed]
- Filter widget outputs
- Cross reference custom post types
- Adding Page Templates to post but it ignored it
- Make a custom_post translatable
- Pre-selecting the category for a custom post type
- Template for all categories of a custom post type?
- browse by category and tags?
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Categories filtering in new post
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Custom post types and category archive
- Migrating a taxonomy’s tags to the native category
- List of Posts and Categories
- Flush Rewrite Rules when new site is created on network
- How can I show 1 featured post in a styled element, and the next few below differently styled
- WordPress custom taxonomy template not working
- How do you create a custom template to display a category with an image and related posts below?
- How can I list Custom Post Types created with the Types plugin under categories?
- List Taxonomies: Don’t list taxonomy if it has no post – depending on custom post-meta?
- How can I get this request to use the Custom Post Type page template instead?
- Custom Post Type Category Link
- How to specify a template for a path like http://example.com/something?
- Custom Post type category pages template and loop
- Archive for a Taxonomy of a Custom Post type
- CPT category hierarchy
- Categorise Custom Post Types
- WP the_posts() on single-cars.php get category link
- Category.php template for custom posts
- How to retrieve category of a post in have_post loop?
- Custom post type pages return 404 page?
- Categories and tags for custom post types
- WordPress 3.9 not using custom template
- Create new custom post and post category of same name
- Tag page only display 10 posts
- category page for custom post type
- Template files for Custom Post Type and Taxonomy
- Set templates for custom post types
- How to Create Template File for Parent Page of Custom Post Type
- in_category for custom post types
- Custom post_type search pages
- Get parent category id from child category page for custom taxonomy
- how to remove pages loading with the archive templates
- Getting used tags per post type