Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Sortable columns option? #32

Open
Gyroscopic opened this issue Jan 11, 2014 · 1 comment
Open

Sortable columns option? #32

Gyroscopic opened this issue Jan 11, 2014 · 1 comment

Comments

@Gyroscopic
Copy link

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' );  
@mboynes
Copy link
Owner

mboynes commented Apr 20, 2014

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants