<?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
- How to change permalink structure for custom post type and it’s taxonomies?
- Filtering a custom post type by custom taxonomy in archive template
- tag.php doesn’t work with tags on a custom post type post?
- Assign single template to multiple custom post types?
- Add Content to Page without shortcodes
- How to build a complex page structure
- Load custom posts with same tag as page
- Hide/Show only specific categories in wp-admin new-post.php
- Custom taxonomy query for a custom post type
- Get categories for a specific post – Custom post type
- Include custom post types in categories widget
- How to get dynamically custom post type that are under a certain category
- How do I create new content pages for my Custom Post Type?
- How to show related posts by category or custom post type?
- Custom Post Type, Two categories, Two columns with Pagination
- New WP_query in template not working with CPT+category on some pages
- Display posts of child category in template
- custom taxonomy – Template not working
- Taxonomy list. Order by a specific custom post type count
- Create separate template for shared custom taxonomy with shared terms
- Custom/separate categories for custom post type
- wordpress 3.4 template files in subdirectories
- Categories not working as expected with custom post type
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- I am trying to output portfolio items with a picture. This code doesn’t seem to be working. What am I doing wrong?
- Help with CPT template pagination
- Merge multiple custom post types in a single archive template
- Get categories and descriptions from custom post type
- Trying to edit the single page from a Custom Post
- How to create new category for custom post type?
- How to show CPTs in term archive
- Custom Post Type template stored in plugin folder not showing in post attributes dropdown
- Group posts by custom post type
- How to clone the “Projects” Custom Post type in Divi theme
- Categories of custom taxonomy don’t show any posts
- Can’t remove front from permalinks for custom taxonomy category page
- Adding custom post type to count in category
- How to use custom template files in deeper directory?
- Pre-selecting the category for a custom post type
- How can I get this request to use the Custom Post Type page template instead?
- category page for custom post type
- Why does accessing url by category cause issues with post types?
- How can I use archive-{post_type}.php theme template?
- Navigate posts with different post type that are in the same categories
- Why does my taxonomy have a category style div id?
- Custom Post Type Category URL
- Custom Post Type Categories URL not displaying posts
- Templates for hierarchical custom post type
- Apply template by path/slug related to custom post type?
- WP Query results showing posts outside of category ID
- Better approach for a WordPress Inventory
- Showing all posts and custom post types by using one category
- List child categories from parent category on custom taxonomy page
- How to properly use Categories with Custom Post Types
- WP not recognizing custom post type / template
- Create a custom taxonomy template that loops through child categories in term order?
- My template won’t apply, theme still fallback to index.php
- Custom post type category permalinks and archive pages
- One Custom Post Type two different Templates
- Can’t Get Parent and Child Categories of Custom Taxonomy to Display
- On click some element i want to use some template
- Display custom post types by category
- Searching in multiple category + URL hierarchy in real estate WordPress site
- Post template with breadcrumb needs to show page navigated from
- How to display custom taxonomy term specific post?
- Category permalinks don’t work even after flushing
- Accessing download link from the loop with WP Download Manager Pro
- How to sort post category using its Description
- Custom WordPress theme not displaying posts from category
- Wanting to list all Post types under a common category
- How to show posts of the same category on a page?
- Modify the category post counting function
- WordPress Custom Post Type – Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered
- Reuse the “category” slug for a custom post type
- Custom post types not displaying per category
- Custom post type with two templates
- How To Display Category list from Portfolio post type plugin?
- Custom Post Type tag taxonomy “Page Not Found”
- DIVs not showing correctly on CPT?
- Dropdown switching subcategories portfolio
- Custom Post type archives / categories give 404
- Custom Post Type – Admin Columns
- Load different template for CPT (in loop) in my plugin?
- Category / Custom Post Type permalink issue
- Categories in custom post types
- Sorting custom post types by category?
- Categories and page filtering with pre_get_posts
- Get all custom_post_type posts + blog posts from one category in a single query
- Most appropriate way to display CPT’s by children terms of custom taxonomies while retaining desired permalink structure?
- Select Category as Page Parent
- CPT Template Option to Top
- How to create custom page templates with default page layout framework?
- Custom post type is_singular condtional not working when managing sidebar display