| @@ 2112-2124 (lines=13) @@ | ||
| 2109 | foreach ( $siblings as $sibling ) { |
|
| 2110 | ||
| 2111 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 2112 | if ( $nextid == $sibling->ID ) { |
|
| 2113 | $wpdb->update( |
|
| 2114 | $wpdb->posts, |
|
| 2115 | array( |
|
| 2116 | 'menu_order' => $menu_order |
|
| 2117 | ), |
|
| 2118 | array( 'ID' => $post->ID ), |
|
| 2119 | array( '%d' ), |
|
| 2120 | array( '%d' ) |
|
| 2121 | ); |
|
| 2122 | $new_pos[ $post->ID ] = $menu_order; |
|
| 2123 | $menu_order++; |
|
| 2124 | } |
|
| 2125 | ||
| 2126 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 2127 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 2144-2156 (lines=13) @@ | ||
| 2141 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 2142 | $menu_order++; |
|
| 2143 | ||
| 2144 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 2145 | $wpdb->update( |
|
| 2146 | $wpdb->posts, |
|
| 2147 | array( |
|
| 2148 | 'menu_order' => $menu_order |
|
| 2149 | ), |
|
| 2150 | array( 'ID' => $post->ID ), |
|
| 2151 | array( '%d' ), |
|
| 2152 | array( '%d' ) |
|
| 2153 | ); |
|
| 2154 | $new_pos[$post->ID] = $menu_order; |
|
| 2155 | $menu_order++; |
|
| 2156 | } |
|
| 2157 | ||
| 2158 | } |
|
| 2159 | ||