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