Add ASC/DESC support to admin interface
-
Hi,
Would you be able to expand the support for the ‘Use query ASC / DESC parameter’ checkbox so that it affects the admin interface as well?
On a particular custom post type, I have chosen to expose the menu_order as a sortable column, so that users can see where each post is sitting in the order. When I try to sort that column into
DESC
order the table stays inASC
order.These are the query params being generated in the URL:
?post_type=client&orderby=menu_order&order=desc
Digging into the plugin code a bit, it seems this can be achieved by changing the code in
include/class-cpto.php
on line 173:From:
$orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
To:
$order = 'ASC'; // Set default order if ($options['use_query_ASC_DESC'] == "1") $order = isset($_GET['order']) ? " " . $_GET['order'] : ' ASC'; $orderBy = "{$wpdb->posts}.menu_order". $order .", {$wpdb->posts}.post_date DESC";
Please consider adding this to the plugin.
Thanks,
Adam Taylor
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add ASC/DESC support to admin interface’ is closed to new replies.