diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index f70996d..fa2bc63 100644
|
|
function wp_ajax_add_menu_item() { |
1158 | 1158 | $_object = get_post( $menu_item_data['menu-item-object-id'] ); |
1159 | 1159 | break; |
1160 | 1160 | |
| 1161 | case 'post_type_archive' : |
| 1162 | $_object = get_post_type_object( $menu_item_data['menu-item-object'] ); |
| 1163 | break; |
| 1164 | |
1161 | 1165 | case 'taxonomy' : |
1162 | 1166 | $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); |
1163 | 1167 | break; |
diff --git src/wp-admin/includes/class-walker-nav-menu-edit.php src/wp-admin/includes/class-walker-nav-menu-edit.php
index b233c32..fdb8055 100644
|
|
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { |
78 | 78 | } elseif ( 'post_type' == $item->type ) { |
79 | 79 | $original_object = get_post( $item->object_id ); |
80 | 80 | $original_title = get_the_title( $original_object->ID ); |
| 81 | } elseif ( 'post_type_archive' == $item->type ) { |
| 82 | $original_object = get_post_type_object( $item->object ); |
| 83 | $original_title = $original_object->labels->archives; |
81 | 84 | } |
82 | 85 | |
83 | 86 | $classes = array( |
diff --git src/wp-admin/includes/nav-menu.php src/wp-admin/includes/nav-menu.php
index de9955a..8ad449c 100644
|
|
function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { |
493 | 493 | } |
494 | 494 | } |
495 | 495 | |
| 496 | $post_type = get_post_type_object( $post_type_name ); |
| 497 | $archive_link = get_post_type_archive_link( $post_type_name ); |
| 498 | if ( $post_type->has_archive ) { |
| 499 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; |
| 500 | array_unshift( $posts, (object) array( |
| 501 | 'ID' => 0, |
| 502 | 'object_id' => $_nav_menu_placeholder, |
| 503 | 'object' => $post_type_name, |
| 504 | 'post_content' => '', |
| 505 | 'post_excerpt' => '', |
| 506 | 'post_title' => $post_type->labels->archives, |
| 507 | 'post_type' => 'nav_menu_item', |
| 508 | 'type' => 'post_type_archive', |
| 509 | 'url' => get_post_type_archive_link( $post_type_name ), |
| 510 | ) ); |
| 511 | } |
| 512 | |
496 | 513 | /** |
497 | 514 | * Filter the posts displayed in the 'View All' tab of the current |
498 | 515 | * post type's menu items meta box. |
diff --git src/wp-includes/nav-menu-template.php src/wp-includes/nav-menu-template.php
index 8c74758..253b654 100644
|
|
function _wp_menu_item_classes_by_context( &$menu_items ) { |
578 | 578 | $active_parent_object_ids[] = (int) $menu_item->post_parent; |
579 | 579 | $active_object = $menu_item->object; |
580 | 580 | |
| 581 | // if the menu item corresponds to the currently-queried post type archive |
| 582 | } elseif ( |
| 583 | 'post_type_archive' == $menu_item->type && |
| 584 | is_post_type_archive( array( $menu_item->object ) ) |
| 585 | ) { |
| 586 | $classes[] = 'current-menu-item'; |
| 587 | $menu_items[$key]->current = true; |
581 | 588 | // if the menu item corresponds to the currently-requested URL |
582 | 589 | } elseif ( 'custom' == $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) { |
583 | 590 | $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); |
diff --git src/wp-includes/nav-menu.php src/wp-includes/nav-menu.php
index 9cce24f..589e7b4 100644
|
|
function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item |
403 | 403 | $original_object = get_post( $args['menu-item-object-id'] ); |
404 | 404 | $original_parent = (int) $original_object->post_parent; |
405 | 405 | $original_title = $original_object->post_title; |
| 406 | } elseif ( 'post_type_archive' == $args['menu-item-type'] ) { |
| 407 | |
| 408 | $original_object = get_post_type_object( $args['menu-item-object'] ); |
| 409 | $original_title = $original_object->labels->archives; |
406 | 410 | } |
407 | 411 | |
408 | 412 | if ( $args['menu-item-title'] == $original_title ) |
… |
… |
function wp_setup_nav_menu_item( $menu_item ) { |
731 | 735 | |
732 | 736 | $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; |
733 | 737 | |
| 738 | } elseif ( 'post_type_archive' == $menu_item->type ) { |
| 739 | $object = get_post_type_object( $menu_item->object ); |
| 740 | if ( $object ) { |
| 741 | $menu_item->title = '' == $menu_item->post_title ? $object->labels->archives : $menu_item->post_title; |
| 742 | } else { |
| 743 | $menu_item->_invalid = true; |
| 744 | } |
| 745 | |
| 746 | $menu_item->type_label = __( 'Post Type Archive' ); |
| 747 | $menu_item->description = ''; |
| 748 | $menu_item->url = get_post_type_archive_link( $menu_item->object ); |
734 | 749 | } elseif ( 'taxonomy' == $menu_item->type ) { |
735 | 750 | $object = get_taxonomy( $menu_item->object ); |
736 | 751 | if ( $object ) { |
diff --git src/wp-includes/post-functions.php src/wp-includes/post-functions.php
index 6d5957b..0bd7893 100644
|
|
function _post_type_meta_capabilities( $capabilities = null ) { |
1315 | 1315 | * - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical |
1316 | 1316 | * ones the default is 'Parent Page:'. |
1317 | 1317 | * - all_items - String for the submenu. Default is All Posts/All Pages. |
| 1318 | * - archives - String for use with archives in nav menus. Default is Post Archives/Page Archives. |
1318 | 1319 | * - insert_into_item - String for the media frame button. Default is Insert into post/Insert into page. |
1319 | 1320 | * - uploaded_to_this_item - String for the media frame filter. Default is Uploaded to this post/Uploaded to this page. |
1320 | 1321 | * - featured_image - Default is Featured Image. |
… |
… |
function get_post_type_labels( $post_type_object ) { |
1353 | 1354 | 'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ), |
1354 | 1355 | 'parent_item_colon' => array( null, __('Parent Page:') ), |
1355 | 1356 | 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), |
| 1357 | 'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ), |
1356 | 1358 | 'insert_into_item' => array( __( 'Insert into post' ), __( 'Insert into page' ) ), |
1357 | 1359 | 'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ), |
1358 | 1360 | 'featured_image' => array( __( 'Featured Image' ), __( 'Featured Image' ) ), |
… |
… |
function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { |
1419 | 1421 | if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) |
1420 | 1422 | $object->labels['all_items'] = $object->labels['menu_name']; |
1421 | 1423 | |
| 1424 | if ( !isset( $object->labels['archives'] ) && isset( $object->labels['all_items'] ) ) { |
| 1425 | $object->labels['archives'] = $object->labels['all_items']; |
| 1426 | } |
| 1427 | |
1422 | 1428 | $defaults = array(); |
1423 | 1429 | foreach ( $nohier_vs_hier_defaults as $key => $value ) { |
1424 | 1430 | $defaults[$key] = $object->hierarchical ? $value[1] : $value[0]; |