| @@ 1897-1909 (lines=13) @@ | ||
| 1894 | foreach ( $siblings as $sibling ) { |
|
| 1895 | ||
| 1896 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 1897 | if ( $nextid == $sibling->ID ) { |
|
| 1898 | $wpdb->update( |
|
| 1899 | $wpdb->posts, |
|
| 1900 | array( |
|
| 1901 | 'menu_order' => $menu_order |
|
| 1902 | ), |
|
| 1903 | array( 'ID' => $post->ID ), |
|
| 1904 | array( '%d' ), |
|
| 1905 | array( '%d' ) |
|
| 1906 | ); |
|
| 1907 | $new_pos[ $post->ID ] = $menu_order; |
|
| 1908 | $menu_order++; |
|
| 1909 | } |
|
| 1910 | ||
| 1911 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 1912 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 1929-1941 (lines=13) @@ | ||
| 1926 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 1927 | $menu_order++; |
|
| 1928 | ||
| 1929 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 1930 | $wpdb->update( |
|
| 1931 | $wpdb->posts, |
|
| 1932 | array( |
|
| 1933 | 'menu_order' => $menu_order |
|
| 1934 | ), |
|
| 1935 | array( 'ID' => $post->ID ), |
|
| 1936 | array( '%d' ), |
|
| 1937 | array( '%d' ) |
|
| 1938 | ); |
|
| 1939 | $new_pos[$post->ID] = $menu_order; |
|
| 1940 | $menu_order++; |
|
| 1941 | } |
|
| 1942 | ||
| 1943 | } |
|
| 1944 | ||