[wp-hackers] display the list of new taxonomy
Mike Schinkel
mikeschinkel at newclarity.net
Fri Jul 2 19:15:02 UTC 2010
On Jul 2, 2010, at 2:40 PM, scribu wrote:
> Actually, there's a template tag for that:
>
> the_taxonomies()<http://xref.yoast.com/trunk/nav.html?_functions/the_taxonomies.html>
That's similar, but not identical. For example, if he had 2 taxonomies (i.e. Actor, Genre) the following:
the_taxonomies(array('post'=>$post->ID,'before'=>'<ul><li>','sep'=>'</li><li>','after'=>'</li></ul>'));
Could generate this HTML where the taxonomies are bulleted, not the terms:
- Actor: Brad Pitt, Georges Clooney, ...
- Genre: Comedy, Drama, ...
On Jul 2, 2010, at 2:44 PM, Andrew Nacin wrote:
> And, wp_list_categories() takes a taxonomy arg as well.
Yes, the following will create an equivalent list of all Actors:
wp_list_categories(array('taxonomy'=>'practice-area','title_li'=>''));
But as far as I can tell there's no easy way to get it to limit to Actors that are associated with a specific Movie. Am I missing something?
-Mike
>
>
> On Fri, Jul 2, 2010 at 9:13 PM, Mike Schinkel
> <mikeschinkel at newclarity.net>wrote:
>
>> 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
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> http://scribu.net
> _______________________________________________
> 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