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

Frank Bueltge frank at bueltge.de
Fri Jul 23 11:19:05 UTC 2010


Thanks Mike, good sleep :)


On Fri, Jul 23, 2010 at 1:12 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> One problem, for sure, is line 131, should be:
>
>  wp_dropdown_categories( 'show_option_all=' . __( 'View all authors', FB_CPT_TEXTDOMAIN ) . '&show_count=1&hierarchical=1&taxonomy=' .FB_CPT_TAXONOMY_TYPE_1 . '&name=' .FB_CPT_TAXONOMY_TYPE_1);
>
> If that doesn't solve it you may be on your own (or get someone else here to help) as I have to get some sleep eventually...
>
> On Jul 23, 2010, at 7:02 AM, Frank Bueltge wrote:
>
>> @mike: i hope is not to much source, is an example plugin to test
>> possibilies with custom post type
>> http://wordpress.pastebin.com/0u7DW03C
>>
>>
>>
>> On Fri, Jul 23, 2010 at 12:31 PM, Mike Schinkel
>> <mikeschinkel at newclarity.net> wrote:
>>> Frank,
>>>
>>> Please show me your  register_post_type, request hook, restrict_manage_posts. Post the code at http://wordpress.pastebin.com/ or http://gist.github.com/ so it's indented and easier to read.
>>>
>>> -Mike
>>>
>>> On Jul 23, 2010, at 6:29 AM, Frank Bueltge wrote:
>>>
>>>> with fitler:
>>>> Array ( [cat] => 26 [order] => DESC [orderby] => date [post_type] =>
>>>> quotes [posts_per_page] => 20 )
>>>>
>>>> default, without filter.
>>>> Array ( [order] => DESC [orderby] => date [post_type] => quotes
>>>> [posts_per_page] => 20 )
>>>>
>>>>
>>>>
>>>> On Fri, Jul 23, 2010 at 12:23 PM, Mike Schinkel
>>>> <mikeschinkel at newclarity.net> wrote:
>>>>> What do you get in the view source when you using this instead:
>>>>>
>>>>> function request($request) {
>>>>>        print_r($request);
>>>>>        exit;
>>>>> }
>>>>>
>>>>> Also, what's your URL after clicking the "Filter" button?
>>>>>
>>>>> -Mike
>>>>>
>>>>>
>>>>> On Jul 23, 2010, at 6:02 AM, Jimmy Roy wrote:
>>>>>
>>>>>> now, when I click on filter button the result is always the same, all list
>>>>>> of ressources.
>>>>>>
>>>>>> my code :
>>>>>>
>>>>>> add_action( 'init', 'register_profperso_taxonomies', 0 );
>>>>>>
>>>>>> function register_profperso_taxonomies() {
>>>>>>
>>>>>> register_taxonomy(
>>>>>> 'classement_fr',
>>>>>> array( 'ressource_fr' ),
>>>>>> array(
>>>>>> 'public' => true,
>>>>>> 'hierarchical' => true,
>>>>>> 'labels' => array(
>>>>>> 'name' => __( 'Classements FR' ),
>>>>>> 'singular_name' => __( 'Classement FR' )
>>>>>> ),
>>>>>> 'query_var' => 'classement-fr',
>>>>>>        'rewrite' => array( 'slug' => 'cours-fr' ),
>>>>>> )
>>>>>> );
>>>>>> }
>>>>>>
>>>>>>
>>>>>> // pour filtrer les ressources par classement
>>>>>> 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&name=classement_fr');
>>>>>> }
>>>>>>
>>>>>> add_action( 'request', 'my_request' );
>>>>>> function my_request($request) {
>>>>>>       if (isset($request['post_type']) &&
>>>>>> $request['post_type']=='ressource_fr') {
>>>>>>               $request['taxonomy'] = 'classement_fr';
>>>>>>               $request['term'] =
>>>>>> get_term($request['classement-fr'],'classement_fr')->name;
>>>>>>               unset($request['name']);
>>>>>>       }
>>>>>>       return $request;
>>>>>> }
>>>>>>
>>>>>> generated html :
>>>>>> <select id="classement_fr" name="classement_fr"> <option value="0">Show All
>>>>>> Classements FR</option> <option value="5">Langue oral</option> <option value
>>>>>> ="6">Niveau 1</option> <option value="7">Niveau 2</option> <option value="8
>>>>>> ">Niveau 3</option> </select><input type="submit" id="post-query-submit"
>>>>>> value="Filtrer" class="button-secondary" />
>>>>>> _______________________________________________
>>>>>> 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
>>>>>
>>>> _______________________________________________
>>>> 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
>>>
>> _______________________________________________
>> 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
>


More information about the wp-hackers mailing list