[wp-trac] [WordPress Trac] #10221: Limit Categories by Parent

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 19 22:06:39 GMT 2009


#10221: Limit Categories by Parent
-----------------------------+----------------------------------------------
 Reporter:  utahcon          |       Owner:  filosofo                                        
     Type:  feature request  |      Status:  new                                             
 Priority:  normal           |   Milestone:  Unassigned                                      
Component:  Taxonomy         |     Version:  2.8                                             
 Severity:  normal           |    Keywords:  wp_list_categories, number, categories, taxonomy
-----------------------------+----------------------------------------------
 Currently you can show the children of a particular taxonomy in
 wp_list_categories()

 For these examples in the DB we have the following taxonomy
 {{{
 Books
    Good Books
    Bad Books
 Cars
    Ugly Cars
    Pretty Cars
 Horse
    Brown Horses
    Black Horses
 }}}

 example:
 {{{
 $cats = wp_list_categories('child_of=1');
 }}}

 this will return

 {{{
 $cats = Array(
    [0] 'Good Books'
    [1] 'Bad Books'
 )
 }}}

 Showing a limited number of top level taxonomies is not possible

 example:
 {{{
 $cats = wp_list_categories('number=2&child_of=0');
 }}}

 The expected results is:
 {{{
 $cats = Array(
    [0] Books
    [1] Cars
 )
 }}}

 the actual result is:

 {{{
 $cats = Array(
    [0] Books
 )
 }}}

 I would propose a new argument call '''parent'''

 example:
 {{{
 $cats = wp_list_categories('parent=0&number=2');
 }}}

 which would return:
 {{{
 $cats = Array(
    [0] Books
    [1] Cars
 )
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10221>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list