| @@ 2056-2068 (lines=13) @@ | ||
| 2053 | foreach ( $siblings as $sibling ) { |
|
| 2054 | ||
| 2055 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 2056 | if ( $nextid == $sibling->ID ) { |
|
| 2057 | $wpdb->update( |
|
| 2058 | $wpdb->posts, |
|
| 2059 | array( |
|
| 2060 | 'menu_order' => $menu_order |
|
| 2061 | ), |
|
| 2062 | array( 'ID' => $post->ID ), |
|
| 2063 | array( '%d' ), |
|
| 2064 | array( '%d' ) |
|
| 2065 | ); |
|
| 2066 | $new_pos[ $post->ID ] = $menu_order; |
|
| 2067 | $menu_order++; |
|
| 2068 | } |
|
| 2069 | ||
| 2070 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 2071 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 2088-2100 (lines=13) @@ | ||
| 2085 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 2086 | $menu_order++; |
|
| 2087 | ||
| 2088 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 2089 | $wpdb->update( |
|
| 2090 | $wpdb->posts, |
|
| 2091 | array( |
|
| 2092 | 'menu_order' => $menu_order |
|
| 2093 | ), |
|
| 2094 | array( 'ID' => $post->ID ), |
|
| 2095 | array( '%d' ), |
|
| 2096 | array( '%d' ) |
|
| 2097 | ); |
|
| 2098 | $new_pos[$post->ID] = $menu_order; |
|
| 2099 | $menu_order++; |
|
| 2100 | } |
|
| 2101 | ||
| 2102 | } |
|
| 2103 | ||