| @@ 2082-2094 (lines=13) @@ | ||
| 2079 | foreach ( $siblings as $sibling ) { |
|
| 2080 | ||
| 2081 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 2082 | if ( $nextid == $sibling->ID ) { |
|
| 2083 | $wpdb->update( |
|
| 2084 | $wpdb->posts, |
|
| 2085 | array( |
|
| 2086 | 'menu_order' => $menu_order |
|
| 2087 | ), |
|
| 2088 | array( 'ID' => $post->ID ), |
|
| 2089 | array( '%d' ), |
|
| 2090 | array( '%d' ) |
|
| 2091 | ); |
|
| 2092 | $new_pos[ $post->ID ] = $menu_order; |
|
| 2093 | $menu_order++; |
|
| 2094 | } |
|
| 2095 | ||
| 2096 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 2097 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 2114-2126 (lines=13) @@ | ||
| 2111 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 2112 | $menu_order++; |
|
| 2113 | ||
| 2114 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 2115 | $wpdb->update( |
|
| 2116 | $wpdb->posts, |
|
| 2117 | array( |
|
| 2118 | 'menu_order' => $menu_order |
|
| 2119 | ), |
|
| 2120 | array( 'ID' => $post->ID ), |
|
| 2121 | array( '%d' ), |
|
| 2122 | array( '%d' ) |
|
| 2123 | ); |
|
| 2124 | $new_pos[$post->ID] = $menu_order; |
|
| 2125 | $menu_order++; |
|
| 2126 | } |
|
| 2127 | ||
| 2128 | } |
|
| 2129 | ||