diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php
index caf6311..f499b0b 100644
a
|
b
|
function wp_ajax_add_menu_item() { |
929 | 929 | case 'taxonomy' : |
930 | 930 | $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); |
931 | 931 | break; |
| 932 | |
| 933 | case 'archive' : |
| 934 | $_object = get_post_type_object( $menu_item_data['menu-item-object'] ); |
| 935 | break; |
932 | 936 | } |
933 | 937 | |
934 | 938 | $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); |
diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php
index c98e32f..60a30f4 100644
a
|
b
|
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { |
69 | 69 | } elseif ( 'post_type' == $item->type ) { |
70 | 70 | $original_object = get_post( $item->object_id ); |
71 | 71 | $original_title = get_the_title( $original_object->ID ); |
72 | | } |
| 72 | } elseif ( 'archive' == $item->type ) { |
| 73 | $original_title = false; |
| 74 | } |
73 | 75 | |
74 | 76 | $classes = array( |
75 | 77 | 'menu-item menu-item-depth-' . $depth, |
… |
… |
function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { |
798 | 800 | 'url' => home_url('/'), |
799 | 801 | ) ); |
800 | 802 | } |
| 803 | } elseif ( $post_type['args']->has_archive ) { |
| 804 | $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; |
| 805 | array_unshift( $posts, (object) array( |
| 806 | 'ID' => 0, |
| 807 | 'object' => $post_type_name, |
| 808 | 'object_id' => $_nav_menu_placeholder, |
| 809 | 'post_content' => '', |
| 810 | 'post_excerpt' => '', |
| 811 | 'post_parent' => '', |
| 812 | 'post_title' => $post_type['args']->labels->items_archive, |
| 813 | 'post_type' => 'nav_menu_item', |
| 814 | 'type' => 'archive', |
| 815 | 'url' => site_url( $post_type['args']->archive_slug ), |
| 816 | ) ); |
801 | 817 | } |
802 | 818 | |
803 | 819 | /** |
diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php
index b7683c3..7363f9e 100644
a
|
b
|
function _wp_menu_item_classes_by_context( &$menu_items ) { |
500 | 500 | $active_parent_object_ids[] = (int) $menu_item->post_parent; |
501 | 501 | $active_object = $menu_item->object; |
502 | 502 | |
| 503 | // if the menu item corresponds to a post type archive |
| 504 | } elseif ( 'archive' == $menu_item->type ) { |
| 505 | if ( is_post_type_archive( $menu_item->object ) || is_singular( $menu_item->object ) ) { |
| 506 | array_push( $classes, 'current-menu-item', 'current_page_item' ); |
| 507 | } |
| 508 | |
503 | 509 | // if the menu item corresponds to the currently-requested URL |
504 | 510 | } elseif ( 'custom' == $menu_item->object ) { |
505 | 511 | $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); |
diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php
index cf9ac14..1a276f2 100644
a
|
b
|
function wp_setup_nav_menu_item( $menu_item ) { |
614 | 614 | $original_title = false; |
615 | 615 | $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; |
616 | 616 | |
| 617 | } elseif ( 'archive' == $menu_item->type ) { |
| 618 | $menu_item->type_label = __('Archive'); |
| 619 | $menu_item->title = $menu_item->post_title; |
| 620 | $menu_item->url = get_post_type_archive_link( $menu_item->object ); |
617 | 621 | } else { |
618 | 622 | $menu_item->type_label = __('Custom'); |
619 | 623 | $menu_item->title = $menu_item->post_title; |
diff --git a/wp-includes/post.php b/wp-includes/post.php
index 7c537f9..763e2e5 100644
a
|
b
|
function register_post_type( $post_type, $args = array() ) { |
1300 | 1300 | add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" ); |
1301 | 1301 | |
1302 | 1302 | if ( $args->has_archive ) { |
1303 | | $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive; |
| 1303 | $args->archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive; |
1304 | 1304 | if ( $args->rewrite['with_front'] ) |
1305 | | $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug; |
| 1305 | $args->archive_slug = substr( $wp_rewrite->front, 1 ) . $args->archive_slug; |
1306 | 1306 | else |
1307 | | $archive_slug = $wp_rewrite->root . $archive_slug; |
| 1307 | $args->archive_slug = $wp_rewrite->root . $args->archive_slug; |
1308 | 1308 | |
1309 | | add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' ); |
| 1309 | $wp_rewrite->add_rule( "{$args->archive_slug}/?$", "index.php?post_type=$post_type", 'top' ); |
1310 | 1310 | if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) { |
1311 | 1311 | $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; |
1312 | | add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); |
1313 | | add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); |
| 1312 | $wp_rewrite->add_rule( "{$args->archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); |
| 1313 | $wp_rewrite->add_rule( "{$args->archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); |
1314 | 1314 | } |
1315 | 1315 | if ( $args->rewrite['pages'] ) |
1316 | | add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' ); |
| 1316 | $wp_rewrite->add_rule( "{$args->archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' ); |
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | $permastruct_args = $args->rewrite; |
… |
… |
function _post_type_meta_capabilities( $capabilities = null ) { |
1471 | 1471 | * - not_found_in_trash - Default is No posts found in Trash/No pages found in Trash |
1472 | 1472 | * - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page: |
1473 | 1473 | * - all_items - String for the submenu. Default is All Posts/All Pages |
| 1474 | * - items_archive - Default is Post Archive |
1474 | 1475 | * - menu_name - Default is the same as <code>name</code> |
1475 | 1476 | * |
1476 | 1477 | * Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages). |
… |
… |
function get_post_type_labels( $post_type_object ) { |
1494 | 1495 | 'not_found' => array( __('No posts found.'), __('No pages found.') ), |
1495 | 1496 | 'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ), |
1496 | 1497 | 'parent_item_colon' => array( null, __('Parent Page:') ), |
1497 | | 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ) |
| 1498 | 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), |
| 1499 | 'items_archive' => array( __( 'Post Archive' ), __( 'Page Archive' ) ), |
1498 | 1500 | ); |
1499 | 1501 | $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; |
1500 | 1502 | |