| @@ 2075-2087 (lines=13) @@ | ||
| 2072 | foreach ( $siblings as $sibling ) { |
|
| 2073 | ||
| 2074 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 2075 | if ( $nextid == $sibling->ID ) { |
|
| 2076 | $wpdb->update( |
|
| 2077 | $wpdb->posts, |
|
| 2078 | array( |
|
| 2079 | 'menu_order' => $menu_order |
|
| 2080 | ), |
|
| 2081 | array( 'ID' => $post->ID ), |
|
| 2082 | array( '%d' ), |
|
| 2083 | array( '%d' ) |
|
| 2084 | ); |
|
| 2085 | $new_pos[ $post->ID ] = $menu_order; |
|
| 2086 | $menu_order++; |
|
| 2087 | } |
|
| 2088 | ||
| 2089 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 2090 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 2107-2119 (lines=13) @@ | ||
| 2104 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 2105 | $menu_order++; |
|
| 2106 | ||
| 2107 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 2108 | $wpdb->update( |
|
| 2109 | $wpdb->posts, |
|
| 2110 | array( |
|
| 2111 | 'menu_order' => $menu_order |
|
| 2112 | ), |
|
| 2113 | array( 'ID' => $post->ID ), |
|
| 2114 | array( '%d' ), |
|
| 2115 | array( '%d' ) |
|
| 2116 | ); |
|
| 2117 | $new_pos[$post->ID] = $menu_order; |
|
| 2118 | $menu_order++; |
|
| 2119 | } |
|
| 2120 | ||
| 2121 | } |
|
| 2122 | ||