I have a custom post type called "portfolio" with 2 registered taxonomies : portfolio_category and portfolio_tag.
I'm using a custom theme that use a lot of javascript/jquery.
So this is how the categories taxonomy is defined in template-portfolio.php (it's just some relevant code used to define categories taxonomy) :
if($pf_categorynotin){
$args['tax_query'] = array(
array(
'taxonomy' => 'portfolio_category',
'field' => 'slug',
'terms' => $pf_categorynotin,
'operator' => 'NOT IN'
)
); //category__in
}
if( have_posts() ) :
while ($wp_query->have_posts()) : $wp_query->the_post();
$post_cat = array();
$post_cat = wp_get_object_terms($post->ID, "portfolio_category");
$post_cats = array();
$post_rel = ' all ';
for($h=0;$h<count($post_cat);$h++){
$post_rel .= $post_cat[$h]->slug.' ';
$post_cats[] = $post_cat[$h]->name;
}
$attachments = get_post_meta($post->ID, '300-160-image', true);
if ($attachments) {
$post_cat = array();
$post_cat = wp_get_object_terms($post->ID, "portfolio_category");
$post_cats = array();
for($h=0;$h<count($post_cat);$h++){
$post_cats[] = $post_cat[$h]->name;
}
$cats_pf_this = implode(", ", $post_cats);
So, this is how the categories taxonomy are defined. For define the tags taxonomy I just have to duplicate this code ? Thanks!