Make WordPress Core


Ignore:
Timestamp:
09/20/2016 08:01:55 PM (8 years ago)
Author:
swissspidy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r38470 r38634  
    578578                ) );
    579579            }
     580        } elseif ( 'edit' == $current_screen->base
     581            && ( $post_type_object = get_post_type_object( $current_screen->post_type ) )
     582            && ( $post_type_object->public )
     583            && ( $post_type_object->show_in_admin_bar )
     584            && ( get_post_type_archive_link( $post_type_object->name ) ) )
     585        {
     586            $wp_admin_bar->add_node( array(
     587                'id' => 'archive',
     588                'title' => $post_type_object->labels->view_items,
     589                'href' => get_post_type_archive_link( $current_screen->post_type )
     590            ) );
    580591        } elseif ( 'term' == $current_screen->base
    581592            && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag )
Note: See TracChangeset for help on using the changeset viewer.