mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Toolbar: Add a 'View Posts' link to the toolbar when on the post listing screen.
This adds a new link to visit the post type archive if the post type supports it. Also introduces a new `view_items` label to `get_post_type_labels()`. Props paulwilde, akibjorklund, swissspidy. Fixes #34113. git-svn-id: https://develop.svn.wordpress.org/trunk@38634 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -577,6 +577,17 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
|
||||
'href' => get_permalink( $post->ID )
|
||||
) );
|
||||
}
|
||||
} elseif ( 'edit' == $current_screen->base
|
||||
&& ( $post_type_object = get_post_type_object( $current_screen->post_type ) )
|
||||
&& ( $post_type_object->public )
|
||||
&& ( $post_type_object->show_in_admin_bar )
|
||||
&& ( get_post_type_archive_link( $post_type_object->name ) ) )
|
||||
{
|
||||
$wp_admin_bar->add_node( array(
|
||||
'id' => 'archive',
|
||||
'title' => $post_type_object->labels->view_items,
|
||||
'href' => get_post_type_archive_link( $current_screen->post_type )
|
||||
) );
|
||||
} elseif ( 'term' == $current_screen->base
|
||||
&& isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag )
|
||||
&& ( $tax = get_taxonomy( $tag->taxonomy ) )
|
||||
|
||||
Reference in New Issue
Block a user