super-cpt icon indicating copy to clipboard operation
super-cpt copied to clipboard

Sortable columns option?

Open Gyroscopic opened this issue 11 years ago • 1 comments

Is there a way to make the columns sortable in the admin cpt listing page?

other than using the usual wp coding eg...

function my_sortable_slide_columns( $columns ) {  
    $columns['slide_order'] = 'slide_order';  
    return $columns;  
}  
add_filter( 'manage_edit-slide_sortable_columns', 'my_sortable_slide_columns' );  

function my_slide_order( $query ) {  
    if( ! is_admin() )  
        return;  
    $orderby = $query->get( 'orderby');  
    if( 'slide_order' == $orderby ) {  
        $query->set('meta_key','slide_order');  
        $query->set('orderby','meta_value_num');  
    }  
}  
add_action( 'pre_get_posts', 'my_slide_order' );  

Gyroscopic avatar Jan 11 '14 21:01 Gyroscopic

There isn't a way to do it out of the box, but I'm not opposed to adding it. I'm leaving this open to see if there's a high enough demand for it.

mboynes avatar Apr 20 '14 06:04 mboynes