[wp-hackers] Custom Post Type in Admin, filter by new custom Taxonomies

Jimmy Roy jimmy.roy at gmail.com
Fri Jul 23 08:23:22 UTC 2010


the generated code is :

<select class="postform" id="cat" name="classement-fr">
<option selected="selected" value="0">Afficher tout</option>
<option value="5" class="level-0">Langue oral&nbsp;&nbsp;(4)</option>
<option value="6" class="level-1">&nbsp;&nbsp;&nbsp;Niveau
1&nbsp;&nbsp;(2)</option>
<option value="7" class="level-1">&nbsp;&nbsp;&nbsp;Niveau
2&nbsp;&nbsp;(1)</option>
<option value="8" class="level-1">&nbsp;&nbsp;&nbsp;Niveau
3&nbsp;&nbsp;(1)</option>
</select>

the id is "cat", like if a regular category, so I add the name parameter
in wp_dropdown_categories and assign to this parameter the query_var value
of the custom taxonomy :

wp_dropdown_categories( 'show_option_all=Afficher
tout&show_count=1&hierarchical=1&taxonomy=classement_fr&name=classement-fr');

now when I click on filter... the result is always all my ressources !


--
Jimmy | www.jimmyroy.fr
--



2010/7/23 Jimmy Roy <jimmy.roy at gmail.com>

> thank u Mike and Scribu, I wrote a mix of your solutions :
>
> add_action( 'restrict_manage_posts', 'my_restrict_manage_posts' );
>
> function my_restrict_manage_posts() {
>  global $typenow;
> if ($typenow=='ressource_fr')
> wp_dropdown_categories( 'show_option_all=Afficher
> tout&show_count=1&hierarchical=1&taxonomy=classement_fr');
> }
>
> but when I click on 'filter' the result is always ... "no result".
>
> Jimmy
>
>
> 2010/7/23 Mike Schinkel <mikeschinkel at newclarity.net>
>
> On Jul 23, 2010, at 3:35 AM, scribu wrote:
>> >> Are you sure?  Unless I misunderstand what Jimmy is asking I think it
>> can
>> >> be done in the "restrict_manage_posts" hook.
>> >
>> > Indeed. Also, he can use wp_dropdown_categories() instead of creating
>> the
>> > select manually.
>>
>> Thanks. :)
>>
>> No matter how hard I try, I can't keep track of every function in the
>> library!  Maybe the new 3.org will help.
>>
>> -Mike
>> _______________________________________________
>> 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