| @@ 2100-2112 (lines=13) @@ | ||
| 2097 | foreach ( $siblings as $sibling ) { |
|
| 2098 | ||
| 2099 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 2100 | if ( $nextid == $sibling->ID ) { |
|
| 2101 | $wpdb->update( |
|
| 2102 | $wpdb->posts, |
|
| 2103 | array( |
|
| 2104 | 'menu_order' => $menu_order |
|
| 2105 | ), |
|
| 2106 | array( 'ID' => $post->ID ), |
|
| 2107 | array( '%d' ), |
|
| 2108 | array( '%d' ) |
|
| 2109 | ); |
|
| 2110 | $new_pos[ $post->ID ] = $menu_order; |
|
| 2111 | $menu_order++; |
|
| 2112 | } |
|
| 2113 | ||
| 2114 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 2115 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 2132-2144 (lines=13) @@ | ||
| 2129 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 2130 | $menu_order++; |
|
| 2131 | ||
| 2132 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 2133 | $wpdb->update( |
|
| 2134 | $wpdb->posts, |
|
| 2135 | array( |
|
| 2136 | 'menu_order' => $menu_order |
|
| 2137 | ), |
|
| 2138 | array( 'ID' => $post->ID ), |
|
| 2139 | array( '%d' ), |
|
| 2140 | array( '%d' ) |
|
| 2141 | ); |
|
| 2142 | $new_pos[$post->ID] = $menu_order; |
|
| 2143 | $menu_order++; |
|
| 2144 | } |
|
| 2145 | ||
| 2146 | } |
|
| 2147 | ||