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