| @@ 1911-1923 (lines=13) @@ | ||
| 1908 | foreach ( $siblings as $sibling ) { |
|
| 1909 | ||
| 1910 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 1911 | if ( $nextid == $sibling->ID ) { |
|
| 1912 | $wpdb->update( |
|
| 1913 | $wpdb->posts, |
|
| 1914 | array( |
|
| 1915 | 'menu_order' => $menu_order |
|
| 1916 | ), |
|
| 1917 | array( 'ID' => $post->ID ), |
|
| 1918 | array( '%d' ), |
|
| 1919 | array( '%d' ) |
|
| 1920 | ); |
|
| 1921 | $new_pos[ $post->ID ] = $menu_order; |
|
| 1922 | $menu_order++; |
|
| 1923 | } |
|
| 1924 | ||
| 1925 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 1926 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 1943-1955 (lines=13) @@ | ||
| 1940 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 1941 | $menu_order++; |
|
| 1942 | ||
| 1943 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 1944 | $wpdb->update( |
|
| 1945 | $wpdb->posts, |
|
| 1946 | array( |
|
| 1947 | 'menu_order' => $menu_order |
|
| 1948 | ), |
|
| 1949 | array( 'ID' => $post->ID ), |
|
| 1950 | array( '%d' ), |
|
| 1951 | array( '%d' ) |
|
| 1952 | ); |
|
| 1953 | $new_pos[$post->ID] = $menu_order; |
|
| 1954 | $menu_order++; |
|
| 1955 | } |
|
| 1956 | ||
| 1957 | } |
|
| 1958 | ||