diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index be1e358..a8bd35a 100644
|
|
function wp_ajax_add_menu_item() { |
1126 | 1126 | $_object = get_post( $menu_item_data['menu-item-object-id'] ); |
1127 | 1127 | break; |
1128 | 1128 | |
| 1129 | case 'post_type_archive' : |
| 1130 | $_object = get_post_type_object( $menu_item_data['menu-item-object'] ); |
| 1131 | break; |
| 1132 | |
1129 | 1133 | case 'taxonomy' : |
1130 | 1134 | $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); |
1131 | 1135 | break; |
diff --git src/wp-admin/includes/nav-menu.php src/wp-admin/includes/nav-menu.php
index 9538bcb..b71efac 100644
|
|
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { |
71 | 71 | } elseif ( 'post_type' == $item->type ) { |
72 | 72 | $original_object = get_post( $item->object_id ); |
73 | 73 | $original_title = get_the_title( $original_object->ID ); |
| 74 | } elseif ( 'post_type_archive' == $item->type ) { |
| 75 | $original_object = get_post_type_object( $item->object ); |
| 76 | $original_title = $original_object->labels->archives; |
74 | 77 | } |
75 | 78 | |
76 | 79 | $classes = array( |
… |
… |
function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { |
819 | 822 | } |
820 | 823 | } |
821 | 824 | |
| 825 | $post_type = get_post_type_object( $post_type_name ); |
| 826 | $archive_link = get_post_type_archive_link( $post_type_name ); |
| 827 | if ( $post_type->has_archive ) { |
| 828 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; |
| 829 | array_unshift( $posts, (object) array( |
| 830 | 'ID' => 0, |
| 831 | 'object_id' => $_nav_menu_placeholder, |
| 832 | 'object' => $post_type_name, |
| 833 | 'post_content' => '', |
| 834 | 'post_excerpt' => '', |
| 835 | 'post_title' => $post_type->labels->archives, |
| 836 | 'post_type' => 'nav_menu_item', |
| 837 | 'type' => 'post_type_archive', |
| 838 | 'url' => get_post_type_archive_link( $post_type_name ), |
| 839 | ) ); |
| 840 | } |
| 841 | |
822 | 842 | /** |
823 | 843 | * Filter the posts displayed in the 'View All' tab of the current |
824 | 844 | * post type's menu items meta box. |
diff --git src/wp-includes/nav-menu-template.php src/wp-includes/nav-menu-template.php
index 7a61031..cd73226 100644
|
|
function _wp_menu_item_classes_by_context( &$menu_items ) { |
552 | 552 | $active_parent_object_ids[] = (int) $menu_item->post_parent; |
553 | 553 | $active_object = $menu_item->object; |
554 | 554 | |
| 555 | // if the menu item corresponds to the currently-queried post type archive |
| 556 | } elseif ( |
| 557 | 'post_type_archive' == $menu_item->type && |
| 558 | is_post_type_archive( array( $menu_item->object ) ) |
| 559 | ) { |
| 560 | $classes[] = 'current-menu-item'; |
| 561 | $menu_items[$key]->current = true; |
555 | 562 | // if the menu item corresponds to the currently-requested URL |
556 | 563 | } elseif ( 'custom' == $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) { |
557 | 564 | $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); |
diff --git src/wp-includes/nav-menu.php src/wp-includes/nav-menu.php
index 90d0cbf..2dea2fc 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 ) { |
718 | 722 | |
719 | 723 | $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; |
720 | 724 | |
| 725 | } elseif ( 'post_type_archive' == $menu_item->type ) { |
| 726 | $object = get_post_type_object( $menu_item->object ); |
| 727 | if ( $object ) { |
| 728 | $menu_item->title = '' == $menu_item->post_title ? $object->labels->archives : $menu_item->post_title; |
| 729 | } else { |
| 730 | $menu_item->_invalid = true; |
| 731 | } |
| 732 | |
| 733 | $menu_item->type_label = __( 'Post Type Archive' ); |
| 734 | $menu_item->description = ''; |
| 735 | $menu_item->url = get_post_type_archive_link( $menu_item->object ); |
721 | 736 | } elseif ( 'taxonomy' == $menu_item->type ) { |
722 | 737 | $object = get_taxonomy( $menu_item->object ); |
723 | 738 | if ( $object ) { |
diff --git src/wp-includes/post-functions.php src/wp-includes/post-functions.php
index fdd01ee..ce9cfe4 100644
|
|
function _post_type_meta_capabilities( $capabilities = null ) { |
1295 | 1295 | * - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical |
1296 | 1296 | * ones the default is 'Parent Page:'. |
1297 | 1297 | * - all_items - String for the submenu. Default is All Posts/All Pages. |
| 1298 | * - archives - String for use with archives in nav menus. Default is Post Archives/Page Archives. |
1298 | 1299 | * - featured_image - Default is Featured Image. |
1299 | 1300 | * - set_featured_image - Default is Set featured image. |
1300 | 1301 | * - remove_featured_image - Default is Remove featured image. |
… |
… |
function get_post_type_labels( $post_type_object ) { |
1326 | 1327 | 'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ), |
1327 | 1328 | 'parent_item_colon' => array( null, __('Parent Page:') ), |
1328 | 1329 | 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), |
| 1330 | 'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ), |
1329 | 1331 | 'featured_image' => array( __( 'Featured Image' ), __( 'Featured Image' ) ), |
1330 | 1332 | 'set_featured_image' => array( __( 'Set featured image' ), __( 'Set featured image' ) ), |
1331 | 1333 | 'remove_featured_image' => array( __( 'Remove featured image' ), __( 'Remove featured image' ) ), |
… |
… |
function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) { |
1387 | 1389 | if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) |
1388 | 1390 | $object->labels['all_items'] = $object->labels['menu_name']; |
1389 | 1391 | |
| 1392 | if ( !isset( $object->labels['archives'] ) && isset( $object->labels['all_items'] ) ) |
| 1393 | $object->labels['archives'] = $object->labels['all_items']; |
| 1394 | |
1390 | 1395 | $defaults = array(); |
1391 | 1396 | foreach ( $nohier_vs_hier_defaults as $key => $value ) { |
1392 | 1397 | $defaults[$key] = $object->hierarchical ? $value[1] : $value[0]; |