Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have this code:

$args=array(
        'post_type' => array ('portfolio'),
        'orderby' => $orderby,
        'order' => 'DESC',
        'paged' => $paged,
        'posts_per_page' => $post_per_page,
        'ignore_sticky_posts' => $do_not_show_stickies
      );
        if($pf_categorynotin){
            $args['tax_query'] = array(
                array(
                    'taxonomy' => 'portfolio_category',
                    'field' => 'slug',
                    'terms' => $pf_categorynotin,
                    'operator' => 'NOT IN'
                )
            ); //category__in
        }

What I'm asking is how to add also "portfolio_tag" taxonomy because I want to list tags from my custom post type. Any suggestions on how to achieve this ? Thanks!

Later edit: here is snippet of the code that is used to retrieve portfolio categories and how they are displayed: snippet

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

I use this function to display comma separated terms from a custom taxonomy:

// Get Comma Seperated List of Custom Taxonomy //
function the_custom_taxonomies($taxonomy) {
    global $post;
    $terms = get_the_terms($post->ID, $taxonomy);
    $counter = 0;
    if (!empty($terms)) {
        foreach ($terms as $term) {
            echo $term->name;
            if (++$counter < count($terms))
                echo ", ";
        }
    }
}
share|improve this answer
    
But where is the taxonomy variable defined? And I don't think it will work in my case because the theme I use loads content through AJAX –  agis Sep 6 '12 at 16:36
    
You should be able to just get away with implode( ',', $terms ) instead of looping. –  Joseph Sep 6 '12 at 16:36
    
Just call it like this: the_custom_taxonomies( 'my_taxonomy' ). –  Joseph Sep 6 '12 at 16:38
    
I've just updated my post with a snippet of the code, please take a look. –  agis Sep 6 '12 at 16:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.