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