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