• Resolved shiningpathos

    (@shiningpathos)


    I’m building a site for an architect and each Project page has a custom taxonomy called Project Services where the client can add various tags. I want to display them in a tag cloud so I’m using this:

    <?php wp_tag_cloud( array( 'taxonomy' => 'project_services', 'separator' => ', ') ); ?>

    But – the problem is that on each Project page, it’s displaying all the various Project Services tags in the database, instead of on a per page basis. Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Maybe you want to use get_the_term_list… just replace “my_custom_tax” with your custom taxonomy.

    $cats_tax = get_the_term_list( $post->ID, 'my_custom_tax', '<li>', ',</li><li>', '</li>') ;
    ?>
    <ul>
    <?php echo $cats_tax ?>
    </ul>
    Thread Starter shiningpathos

    (@shiningpathos)

    Thanks. Looks like this will work –

    <?php global $post; $terms = get_the_terms( $post->ID, 'team_members' ); $tag_list = implode(',', wp_list_pluck($terms, 'term_id') );
            				$args = array(
      						'taxonomy' => 'project_services',
      						'separator' => ', ',
      						'include' => $tag_list
    						);
    						wp_tag_cloud( $args );
    					?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘using wp_tag_cloud with custom taxonomy’ is closed to new replies.