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