Changeset 38634
- Timestamp:
- 09/20/2016 08:01:55 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/admin-bar.php
r38470 r38634 578 578 ) ); 579 579 } 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 ) ); 580 591 } elseif ( 'term' == $current_screen->base 581 592 && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) -
trunk/src/wp-includes/post.php
r38408 r38634 1235 1235 * - `new_item` - Label for the new item page title. Default is 'New Post' / 'New Page'. 1236 1236 * - `view_item` - Label for viewing a singular item. Default is 'View Post' / 'View Page'. 1237 * - `view_items` - Label for viewing post type archives. Default is 'View Posts' / 'View Pages'. 1237 1238 * - `search_items` - Label for searching plural items. Default is 'Search Posts' / 'Search Pages'. 1238 1239 * - `not_found` - Label used when no items are found. Default is 'No posts found' / 'No pages found'. … … 1268 1269 * `items_list_navigation`, and `items_list` labels. 1269 1270 * @since 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object. 1271 * @since 4.7.0 Added the `view_items` label. 1270 1272 * 1271 1273 * @access private … … 1283 1285 'new_item' => array( __('New Post'), __('New Page') ), 1284 1286 'view_item' => array( __('View Post'), __('View Page') ), 1287 'view_items' => array( __('View Posts'), __('View Pages') ), 1285 1288 'search_items' => array( __('Search Posts'), __('Search Pages') ), 1286 1289 'not_found' => array( __('No posts found.'), __('No pages found.') ), -
trunk/tests/phpunit/tests/adminbar.php
r38508 r38634 381 381 } 382 382 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 } 383 410 }
Note: See TracChangeset
for help on using the changeset viewer.