| @@ 1881-1893 (lines=13) @@ | ||
| 1878 | foreach ( $siblings as $sibling ) { |
|
| 1879 | ||
| 1880 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 1881 | if ( $nextid == $sibling->ID ) { |
|
| 1882 | $wpdb->update( |
|
| 1883 | $wpdb->posts, |
|
| 1884 | array( |
|
| 1885 | 'menu_order' => $menu_order |
|
| 1886 | ), |
|
| 1887 | array( 'ID' => $post->ID ), |
|
| 1888 | array( '%d' ), |
|
| 1889 | array( '%d' ) |
|
| 1890 | ); |
|
| 1891 | $new_pos[ $post->ID ] = $menu_order; |
|
| 1892 | $menu_order++; |
|
| 1893 | } |
|
| 1894 | ||
| 1895 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 1896 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 1913-1925 (lines=13) @@ | ||
| 1910 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 1911 | $menu_order++; |
|
| 1912 | ||
| 1913 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 1914 | $wpdb->update( |
|
| 1915 | $wpdb->posts, |
|
| 1916 | array( |
|
| 1917 | 'menu_order' => $menu_order |
|
| 1918 | ), |
|
| 1919 | array( 'ID' => $post->ID ), |
|
| 1920 | array( '%d' ), |
|
| 1921 | array( '%d' ) |
|
| 1922 | ); |
|
| 1923 | $new_pos[$post->ID] = $menu_order; |
|
| 1924 | $menu_order++; |
|
| 1925 | } |
|
| 1926 | ||
| 1927 | } |
|
| 1928 | ||