Skip to main content
3 of 3
added 16 characters in body
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

Display specific taxonomy

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 ) );

ob_start();
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.