Using a loop to display terms associated with a post

This answer was a joint effort with tnorthcutt so I made it community wiki. There are several interesting functions available: the_taxonomies(), which calls get_the_taxonomies(), which in turn calls get_object_taxonomies() and wp_get_object_terms(). the_taxonomies() is a documented template tag and is a light wrapper around a call to get_the_taxonomies(), which is undocumented. get_object_taxonomies() returns a list of … Read more

If taxonomy exists then to show some code

If you want to check for the existence of a taxonomy, use taxonomy_exists( $taxonomy ): <?php if(taxonomy_exists(‘country’)){ echo ‘All courses in’ . get_the_term_list($post->ID,’country’, ‘ ‘, ‘ ‘, ” ); } ?> etc… Edit If, instead of checking for the existence of a taxonomy, you want to check if the current post belongs to a taxonomy, … Read more

Can I turn off write-in tags/taxonomies?

Here is what I came up with, seems to work: add_filter( ‘pre_post_tags_input’, ‘no_tags_input_create’ ); add_filter( ‘pre_post_tax_input’, ‘no_tax_input_create’ ); function no_tags_input_create($tags_input) { $output = array(); foreach( $tags_input as $tag ) if( term_exists( $tag, ‘post_tag’) ) $output[] = $tag; return $output; } function no_tax_input_create($tax_input) { if( !isset($tax_input[‘post_tag’]) ) return $tax_input; $output = array(); $tags = explode(‘,’, $tax_input[‘post_tag’]); … Read more

Ajax post filter by taxonomy

I believe WordPress can handle multiple query parameter by default. You can load http://wordpresssite.com/?taxonomy-1=term-a&?taxonomy-2=term-b to query all post that belongs to term a (in taxonomy 1) AND term b (in taxonomy 2). Use JQuery load() function to load the intended query parameter, based on the selected item on the sidebar. Hope this help.