diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php index ed65d3a63a..c5893dd0b8 100644 --- a/src/wp-admin/edit-form-advanced.php +++ b/src/wp-admin/edit-form-advanced.php @@ -431,6 +431,46 @@ cap->create_posts ) ) { echo ' ' . esc_html( $post_type_object->labels->add_new ) . ''; + + /** + * Adds Previous and Next links alongside Add New link. + * Setting works per user per post type. + * + * @since CP-2.0.0 + */ + $nav_display = 'inline'; + $metaboxhidden = (array) get_user_meta( get_current_user_id(), 'metaboxhidden_' . $post_type_object->name, true ); + + if ( in_array( 'adminpostnavspan', $metaboxhidden ) ) { + $nav_display = 'none'; + } + + $next_post = get_next_post(); + $previous_post = get_previous_post(); + + echo ''; + + if ( ! empty( $previous_post ) ) { + + $previous_link = esc_url( admin_url() . 'post.php?post=' . $previous_post->ID . '&action=edit' ); + + $prev_title = _x( 'Previous post: ', 'Admin Post Navigation' ) . esc_attr( $previous_post->post_title ); + + echo ' ' . _x( '← Previous', 'Admin Post Navigation' ) . ''; + + } + + if ( ! empty( $next_post ) ) { + + $next_link = esc_url( admin_url() . 'post.php?post=' . $next_post->ID . '&action=edit' ); + + $next_title = _x( 'Next post: ', 'Admin Post Navigation' ) . esc_attr( $next_post->post_title ); + + echo ' ' . _x( 'Next →', 'Admin Post Navigation' ) . ''; + + } + + echo ''; } ?> diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php index d978593a4c..68be789f19 100644 --- a/src/wp-admin/includes/class-wp-screen.php +++ b/src/wp-admin/includes/class-wp-screen.php @@ -975,9 +975,30 @@ public function show_screen_options() { $this->_screen_settings = ''; if ( 'post' === $this->base ) { - $expand = ''; + + $expand = ''; + $this->_screen_settings = $expand; }