| @@ 2031-2043 (lines=13) @@ | ||
| 2028 | foreach ( $siblings as $sibling ) { |
|
| 2029 | ||
| 2030 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 2031 | if ( $nextid == $sibling->ID ) { |
|
| 2032 | $wpdb->update( |
|
| 2033 | $wpdb->posts, |
|
| 2034 | array( |
|
| 2035 | 'menu_order' => $menu_order |
|
| 2036 | ), |
|
| 2037 | array( 'ID' => $post->ID ), |
|
| 2038 | array( '%d' ), |
|
| 2039 | array( '%d' ) |
|
| 2040 | ); |
|
| 2041 | $new_pos[ $post->ID ] = $menu_order; |
|
| 2042 | $menu_order++; |
|
| 2043 | } |
|
| 2044 | ||
| 2045 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 2046 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 2063-2075 (lines=13) @@ | ||
| 2060 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 2061 | $menu_order++; |
|
| 2062 | ||
| 2063 | if ( ! $nextid && $previd == $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 | } |
|
| 2078 | ||