| @@ 1853-1865 (lines=13) @@ | ||
| 1850 | foreach ( $siblings as $sibling ) { |
|
| 1851 | ||
| 1852 | // if this is the post that comes after our repositioned post, set our repositioned post position and increment menu order |
|
| 1853 | if ( $nextid == $sibling->ID ) { |
|
| 1854 | $wpdb->update( |
|
| 1855 | $wpdb->posts, |
|
| 1856 | array( |
|
| 1857 | 'menu_order' => $menu_order |
|
| 1858 | ), |
|
| 1859 | array( 'ID' => $post->ID ), |
|
| 1860 | array( '%d' ), |
|
| 1861 | array( '%d' ) |
|
| 1862 | ); |
|
| 1863 | $new_pos[ $post->ID ] = $menu_order; |
|
| 1864 | $menu_order++; |
|
| 1865 | } |
|
| 1866 | ||
| 1867 | // if repositioned post has been set, and new items are already in the right order, we can stop |
|
| 1868 | if ( isset( $new_pos[ $post->ID ] ) && $sibling->menu_order >= $menu_order ) { |
|
| @@ 1885-1897 (lines=13) @@ | ||
| 1882 | $new_pos[ $sibling->ID ] = $menu_order; |
|
| 1883 | $menu_order++; |
|
| 1884 | ||
| 1885 | if ( ! $nextid && $previd == $sibling->ID ) { |
|
| 1886 | $wpdb->update( |
|
| 1887 | $wpdb->posts, |
|
| 1888 | array( |
|
| 1889 | 'menu_order' => $menu_order |
|
| 1890 | ), |
|
| 1891 | array( 'ID' => $post->ID ), |
|
| 1892 | array( '%d' ), |
|
| 1893 | array( '%d' ) |
|
| 1894 | ); |
|
| 1895 | $new_pos[$post->ID] = $menu_order; |
|
| 1896 | $menu_order++; |
|
| 1897 | } |
|
| 1898 | ||
| 1899 | } |
|
| 1900 | ||