[wp-trac] [WordPress Trac] #23421: Follow on from #21240. Add sortable to taxonomy column

WordPress Trac noreply at wordpress.org
Fri Feb 8 12:45:14 UTC 2013


#23421: Follow on from #21240. Add sortable to taxonomy column
-------------------------+------------------------------
 Reporter:  tifosi       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Taxonomy     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------
Changes (by SergeyBiryukov):

 * type:  feature request => enhancement


Old description:

> Following on from the #21240 ticket which introduced the
> show_admin_column functionality one limitation is the 'as easy' way to
> make that column sortable.
>
> It's possible to do it through the
> 'manage_edit-{$post_type}_sortable_columns' filter but the column_key is
> different for 3.5+. A standardisation as for adding the column may be
> advantageous: a register_taxonomy argument and / or new filter.
>
> argument: show_column_sortable, boolean default false, requires
> show_admin_column to be set and true.
>
> In the same way that the get_columns function uses the new
> "manage_taxonomies_for_{$post_type}_columns", filter to add a taxonomy
> column there could be a
> "manage_taxonomies_for_{$post_type}_sortable_columns" filter in the
> get_sortable_columns function of the post-list class:
>
> i.e.
>
> function get_sortable_columns() {
>   $default = array(
>               'title'    => 'title',
>               'parent'   => 'parent',
>               'comments' => 'comment_count',
>               'date'     => array( 'date', true )
>               );
>
>  return apply_filters(
> "manage_taxonomies_for_{$post_type}_sortable_columns", $default );
>         }
>
> The developer could then set the filter as normal
> add_filter ( "manage_taxonomies_for_{$post_type}_columns",
> 'add_sortable_column' );
>
> function add_sortable_column ( $columns ) {
>  $columns[ taxonomy-tax_name ] = 'Taxonomy Label';
>  return $columns;
> }

New description:

 Following on from the #21240 ticket which introduced the show_admin_column
 functionality one limitation is the 'as easy' way to make that column
 sortable.

 It's possible to do it through the
 'manage_edit-{$post_type}_sortable_columns' filter but the column_key is
 different for 3.5+. A standardisation as for adding the column may be
 advantageous: a register_taxonomy argument and / or new filter.

 argument: show_column_sortable, boolean default false, requires
 show_admin_column to be set and true.

 In the same way that the get_columns function uses the new
 "manage_taxonomies_for_{$post_type}_columns", filter to add a taxonomy
 column there could be a
 "manage_taxonomies_for_{$post_type}_sortable_columns" filter in the
 get_sortable_columns function of the post-list class:

 i.e.
 {{{
 function get_sortable_columns() {
         $default = array(
                 'title'    => 'title',
                 'parent'   => 'parent',
                 'comments' => 'comment_count',
                 'date'     => array( 'date', true )
         );

         return apply_filters(
 "manage_taxonomies_for_{$post_type}_sortable_columns", $default );
 }
 }}}
 The developer could then set the filter as normal
 {{{
 add_filter( "manage_taxonomies_for_{$post_type}_columns",
 'add_sortable_column' );

 function add_sortable_column ( $columns ) {
         $columns[ taxonomy-tax_name ] = 'Taxonomy Label';
         return $columns;
 }
 }}}

--

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23421#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list