[wp-hackers] display the list of new taxonomy

Mike Schinkel mikeschinkel at newclarity.net
Fri Jul 2 18:13:11 UTC 2010


Hi Jimmy,

I'm assuming that you know how to create a sidebar widget so I'll skip that step.  Here's the basic code you need:

	// $post is assumed to be a post for a Movie	
	$actors = wp_get_object_terms($post->ID,'actor');
	echo '<ul>';
	foreach($actors as $actor) {
		echo '<li>';
		echo $actor->name;
		echo '</li>';
	}
	echo '</ul>';

Hope it helps.

-Mike

On Jul 2, 2010, at 12:32 PM, Jimmy Roy wrote:

> sorry for double post, I forgot to change the message object.
> 
> hi all,
> I just start to play with custom post type and custom taxonomies.
> I follow the excellent tutorial by Justin Tadlock everything works fine, now
> I want to display the list of taxonomies associate to my new custom post
> type (something like wp_list_categories()).
> 
> for example I create a new custom post type called Movie and a taxonomy
> called Actor.
> 
> I want to display in the sidebar :
> *Actors*
> 
>   - Brad Pitt
>   - Georges Clooney
>   - ...
> 
> any idea to do that?
> 
> thank u for your help.
> 
> Jimmy
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list