I am trying to list only the posts from a single category of my custom taxonomy.
I have created a custom post type called "Inventory" and a custom taxonomy called "Inventory Category".
I then created a number of categories using the "Inventory Category" taxonomy.
I would now like to display the posts from only a single category. fyi, this is not for display on the taxonomy.php page, that is all set up and working fine. This loop will be called on other pages.
This is the code I have so far, it returns ALL posts from the "Inventory Category" taxonomy rather than just those in the category "bulk racks".
query_posts( array( 'post_type' => 'inventory', 'inventory-category' => 'bulk-racks' ) );
Any help would be greatly appreciated!
Here is how i created the custom post type & taxonomy:
/* --- Create Inventory Custom Post Type --- */
add_action('init', 'inventory_register');
function inventory_register() {
$args = array(
'label' => __('Inventory'),
'singular_label' => __('Inventory'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => true,
'rewrite' => true,
'supports' => array('title', 'thumbnail', 'revisions','custom-fields')
);
register_post_type( 'inventory' , $args );
}
/* --- Register Custom Taxonomy for Inventory Lists --- */
add_action( 'init', 'register_my_taxonomies', 0 );
function register_my_taxonomies() {
register_taxonomy(
'division',
array( 'inventory' ),
array(
'hierarchical' => true,
'public' => true,
'labels' => array(
'name' => __( 'Inventory Category' ),
'singular_name' => __( 'Inventory Categories' ),
'show_ui' => true,
'show_in_nav_menus' => true,
),
)
);
}