Changeset 997790
- Timestamp:
- 09/27/2014 11:43:34 PM (11 years ago)
- Location:
- simple-page-ordering/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
simple-page-ordering.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-page-ordering/trunk/readme.txt
r968419 r997790 4 4 Tags: order, re-order, ordering, pages, page, manage, menu_order, hierarchical, ajax, drag-and-drop, admin 5 5 Requires at least: 3.8 6 Tested up to: 3.9.27 Stable tag: 2.2. 26 Tested up to: 4.0 7 Stable tag: 2.2.3 8 8 9 9 Order your pages and other hierarchical post types with simple drag and drop right from the standard page list. … … 77 77 78 78 == Changelog == 79 80 = 2.2.3 = 81 * Fixed ordering in WordPress 4.0 following core changes to ORDER BY in WP_Query 79 82 80 83 = 2.2.2 = -
simple-page-ordering/trunk/simple-page-ordering.php
r968419 r997790 4 4 Plugin URI: http://10up.com/plugins/simple-page-ordering-wordpress/ 5 5 Description: Order your pages and hierarchical post types using drag and drop on the built in page list. For further instructions, open the "Help" tab on the Pages screen. 6 Version: 2.2. 26 Version: 2.2.3 7 7 Author: Jake Goldman, 10up 8 8 Author URI: http://10up.com … … 81 81 */ 82 82 public static function wp() { 83 if ( 0 === strpos( get_query_var('orderby'), 'menu_order' ) ) { 83 $orderby = get_query_var('orderby'); 84 if ( ( is_string( $orderby ) && 0 === strpos( $orderby, 'menu_order' ) ) || ( isset( $orderby['menu_order'] ) && $orderby['menu_order'] == 'ASC' ) ) { 84 85 $script_name = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? 'simple-page-ordering.dev.js' : 'simple-page-ordering.js'; 85 86 wp_enqueue_script( 'simple-page-ordering', plugins_url( $script_name, __FILE__ ), array('jquery-ui-sortable'), '2.1', true ); … … 120 121 error_reporting( 0 ); 121 122 } 123 124 global $wp_version; 122 125 123 126 $previd = empty( $_POST['previd'] ) ? false : (int) $_POST['previd']; … … 157 160 )); 158 161 159 $siblings = new WP_Query(array(162 $siblings_query = array( 160 163 'depth' => 1, 161 164 'posts_per_page' => $max_sortable_posts, … … 163 166 'post_status' => $post_stati, 164 167 'post_parent' => $parent_id, 165 'orderby' => 'menu_order title', 166 'order' => 'ASC', 168 'orderby' => array( 'menu_order' => 'ASC', 'title' => 'ASC' ), 167 169 'post__not_in' => $excluded, 168 170 'update_post_term_cache' => false, … … 170 172 'suppress_filters' => true, 171 173 'ignore_sticky_posts' => true, 172 )); // fetch all the siblings (relative ordering) 174 ); 175 if ( version_compare( $wp_version, '4.0', '<' ) ) { 176 $siblings_query['orderby'] = 'menu_order title'; 177 $siblings_query['order'] = 'ASC'; 178 } 179 $siblings = new WP_Query( $siblings_query ); // fetch all the siblings (relative ordering) 173 180 174 181 // don't waste overhead of revisions on a menu order change (especially since they can't *all* be rolled back at once) … … 275 282 public static function sort_by_order_link( $views ) { 276 283 $class = ( get_query_var('orderby') == 'menu_order title' ) ? 'current' : ''; 277 $query_string = esc_url( remove_query_arg(array( 'orderby', 'order' )) ); 278 $query_string = add_query_arg( 'orderby', urlencode('menu_order title'), $query_string ); 284 $query_string = esc_url( remove_query_arg( array( 'orderby', 'order' ) ) ); 285 if ( ! is_post_type_hierarchical( get_post_type() ) ) { 286 $query_string = add_query_arg( 'orderby', urlencode( 'menu_order title' ), $query_string ); 287 $query_string = add_query_arg( 'order', 'asc', $query_string ); 288 } 279 289 $views['byorder'] = sprintf('<a href="%s" class="%s">%s</a>', $query_string, $class, __("Sort by Order", 'simple-page-ordering')); 280 290
Note: See TracChangeset
for help on using the changeset viewer.