I have a custom post type LOCATIONS I have a custom taxonomy LANDMARKS Under LANDMARKS, I have a list of building landmarks On some pages/posts, I want to be able to insert specific landmark from the taxonomy list instead of displaying the entire list.

I thought I can use custom fields but I would prefer it to work like taxonomy where upon user click, it will show all posts related to that landmark.

After a search, it seems that it is not possible to display a single taxonomy term? This is the snippet I'm using to display taxonomy list.

function list_terms_custom_taxonomy( $atts) {
extract( shortcode_atts( array(
    'custom_taxonomy' => '',
), $atts ) );

global $post;
$string1 = '<ul class="tax_listing">';
$string1 .= get_the_term_list( $post->ID , $custom_taxonomy, '<li>', '</li>' . ', ' . '<li>', '</li>' );
$string1 .= ob_get_clean();
$string1 .= '</ul>';
return $string1;

add_shortcode( 'wp', 'list_terms_custom_taxonomy' );
add_filter('widget_text', 'do_shortcode');

Additional info: I'm using TYPES plugin.

1 Answer 1


you need to use this code to get all the terms :

 <?php $custom_terms= get_terms('locations');                          
       foreach($custom_terms as $term):
       <a href="<?php echo get_term_link( $term->name, 'locations' ); ?>" class="browse_more"><?phpecho $term->name; ?>
 <?php   endforeach;               

This will generate all the terms and when you click term you will be taken to the page of that specific custom terms and there you can use the loop to get all the posts for that specific category. You will need to create the file taxonomy.php
Put the following code there

    $term = get_queried_object();
    $args =array(
                 'post_type' => 'packages',
                 'posts_per_page' =>6, 
                 'tax_query' =>
                                     'taxonomy' => 'locations',
                                     'field'    => 'name',
                                     'terms'    => $term->name,
  $loop = new WP_Query( $args );                                             
  if($loop->have_posts()):while ( $loop->have_posts() ): $loop->the_post();

I hope this solves your problemO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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