I am trying to retrieve some custom post type from their specific parent category.
<div class="tab-content">
<?php
$cat_menu = get_categories('taxonomy=menu_categorie&type=menus');
foreach($cat_menu as $menu) {
echo '<div role="tabpanel" class="tab-pane active fade" id="'.$menu->slug.'">';
$id = (int) $menu->cat_ID;
$args = array(
'post_type' => 'menus',
'post_status' => 'publish',
'cat' => $id
);
$recipes = new WP_Query($args);
if($recipes->have_posts()) : while($recipes->have_posts()) : $recipes->the_post();
echo the_title();
endwhile; endif;
echo '</div>';
}
?>
</div>
if I remove, in the array $args, the key 'cat', it will work but it will output ALL my menu. What I want is to be able to output my menu post type from the category_id, but I have nothing that shows up. So I guess $recipes have nothing in it, then fails.
Is there something I missed out to retrieve custom post type with a specific category id?