I’m trying to display only certain categories for a custom post called portfolio in my portfolio template page. I am amble to display only 1 category by the slug but I need to display more than 1 and I’ll like to know if there’s a way to filter the categories by their ID.
CODE
global $wp_query;
$portfolio_items = $sd_data['portfolio_items']; // Get Items per Page Value
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => $portfolio_items,
'post_status' => 'publish',
'orderby' => 'date',
'paged' => $paged
);
// Only pull from selected taxonomy
$selected_taxonomies = rwmb_meta('sd_portfolio-taxonomies', 'type=checkbox_list');
if($selected_taxonomies && $selected_taxonomies[0] == 0) {
unset($selected_taxonomies[0]);
}
if($selected_taxonomies){
$args['tax_query'][] = array(
'taxonomy' => 'portfolio_filter',
'field' => 'ID',
'terms' => $selected_taxonomies
);
}
$wp_query = new WP_Query($args);
query_posts( array( 'portfolio_filter' => 'extra', 'posts_per_page' => -1 ) );
As you can see I can only filter the category extra but I need to filter more than 1 and I’ll like to know if there’s a way to filter the categories by their IDs