Make WordPress Core


Ignore:
Timestamp:
09/20/2016 08:01:55 PM (9 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/tests/phpunit/tests/adminbar.php

    r38508 r38634  
    381381    }
    382382
     383    /**
     384     * @ticket 34113
     385     */
     386    public function test_admin_bar_contains_view_archive_link() {
     387        set_current_screen( 'edit-post' );
     388
     389        $wp_admin_bar = $this->get_standard_admin_bar();
     390        $node         = $wp_admin_bar->get_node( 'archive' );
     391
     392        set_current_screen( 'front' );
     393
     394        $this->assertNotNull( $node );
     395    }
     396
     397    /**
     398     * @ticket 34113
     399     */
     400    public function test_admin_bar_has_no_archives_link_for_post_types_without_archive() {
     401        set_current_screen( 'edit-page' );
     402
     403        $wp_admin_bar = $this->get_standard_admin_bar();
     404        $node         = $wp_admin_bar->get_node( 'archive' );
     405
     406        set_current_screen( 'front' );
     407
     408        $this->assertNull( $node );
     409    }
    383410}
Note: See TracChangeset for help on using the changeset viewer.