| @@ 2063-2075 (lines=13) @@ | ||
| 2060 | foreach ( $siblings as $sibling ) { |
|
| 2061 | ||
| 2062 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 2063 | if ( $nextid == $sibling->ID ) { |
|
| 2064 | $wpdb->update( |
|
| 2065 | $wpdb->posts, |
|
| 2066 | array( |
|
| 2067 | 'menu_order' => $menu_order |
|
| 2068 | ), |
|
| 2069 | array( 'ID' => $post->ID ), |
|
| 2070 | array( '%d' ), |
|
| 2071 | array( '%d' ) |
|
| 2072 | ); |
|
| 2073 | $new_pos[ $post->ID ] = $menu_order; |
|
| 2074 | $menu_order++; |
|
| 2075 | } |
|
| 2076 | ||
| 2077 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 2078 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 2095-2107 (lines=13) @@ | ||
| 2092 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 2093 | $menu_order++; |
|
| 2094 | ||
| 2095 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 2096 | $wpdb->update( |
|
| 2097 | $wpdb->posts, |
|
| 2098 | array( |
|
| 2099 | 'menu_order' => $menu_order |
|
| 2100 | ), |
|
| 2101 | array( 'ID' => $post->ID ), |
|
| 2102 | array( '%d' ), |
|
| 2103 | array( '%d' ) |
|
| 2104 | ); |
|
| 2105 | $new_pos[$post->ID] = $menu_order; |
|
| 2106 | $menu_order++; |
|
| 2107 | } |
|
| 2108 | ||
| 2109 | } |
|
| 2110 | ||