Reply To: Displaying terms from Taxonomies in Poi List.

Home Forums MapPress Support Displaying terms from Taxonomies in Poi List. Reply To: Displaying terms from Taxonomies in Poi List.

#14251
Chris
Keymaster

Hi,

Sure, I assume you’re using a mashup map? If so you just need to get the underlying post ID from the POI, and then you can use standard WordPress functions to get the terms for each post.

For example this should print the terms for each post from one taxonomy ‘mytaxonomy’:


if ($poi->postid) {
  $terms = get_the_terms( $poi->postid, 'mytaxonomy' );
  if ( $terms && ! is_wp_error( $terms ) ) {
    foreach ( $terms as $term ) { 
	  echo $term->name;
	}
  }
}

If you need to get more info about each term (like its label) you can use the WordPress get_term() function on each term.

There are some examples here that might help:
http://codex.wordpress.org/Function_Reference/get_term
http://codex.wordpress.org/Function_Reference/get_the_terms