Ticket #16075: 16075.5.diff
File 16075.5.diff, 5.9 KB (added by , 12 years ago) |
---|
-
wp-includes/nav-menu-template.php
372 372 $active_parent_object_ids[] = (int) $menu_item->post_parent; 373 373 $active_object = $menu_item->object; 374 374 375 // if the menu item corresponds to a post type archive 376 } elseif ( 'archive' == $menu_item->type ) { 377 if ( is_post_type_archive( $menu_item->object ) || is_singular( $menu_item->object ) ) { 378 array_push( $classes, 'current-menu-item', 'current_page_item'); 379 } 380 375 381 // if the menu item corresponds to the currently-requested URL 376 382 } elseif ( 'custom' == $menu_item->object ) { 377 383 $_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] ); -
wp-includes/post.php
1246 1246 add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name="); 1247 1247 1248 1248 if ( $args->has_archive ) { 1249 $ar chive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;1249 $args->archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive; 1250 1250 if ( $args->rewrite['with_front'] ) 1251 $ar chive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;1251 $args->archive_slug = substr( $wp_rewrite->front, 1 ) . $args->archive_slug; 1252 1252 else 1253 $ar chive_slug = $wp_rewrite->root . $archive_slug;1253 $args->archive_slug = $wp_rewrite->root . $args->archive_slug; 1254 1254 1255 add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );1255 $wp_rewrite->add_rule( "{$args->archive_slug}/?$", "index.php?post_type=$post_type", 'top' ); 1256 1256 if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) { 1257 1257 $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; 1258 add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );1259 add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );1258 $wp_rewrite->add_rule( "{$args->archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); 1259 $wp_rewrite->add_rule( "{$args->archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); 1260 1260 } 1261 1261 if ( $args->rewrite['pages'] ) 1262 add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );1262 $wp_rewrite->add_rule( "{$args->archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' ); 1263 1263 } 1264 1264 1265 1265 add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $args->rewrite ); … … 1436 1436 'not_found' => array( __('No posts found.'), __('No pages found.') ), 1437 1437 'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ), 1438 1438 'parent_item_colon' => array( null, __('Parent Page:') ), 1439 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ) 1439 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), 1440 'items_archive' => array( __( 'Post Archive' ), __( 'Page Archive' ) ), 1440 1441 ); 1441 1442 $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name']; 1442 1443 -
wp-includes/nav-menu.php
609 609 $original_title = false; 610 610 $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; 611 611 612 } elseif ( 'archive' == $menu_item->type ) { 613 $menu_item->type_label = __('Archive'); 614 $menu_item->title = $menu_item->post_title; 615 $menu_item->url = get_post_type_archive_link( $menu_item->object ); 612 616 } else { 613 617 $menu_item->type_label = __('Custom'); 614 618 $menu_item->title = $menu_item->post_title; -
wp-admin/includes/ajax-actions.php
861 861 case 'taxonomy' : 862 862 $_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] ); 863 863 break; 864 865 case 'archive' : 866 $_object = get_post_type_object( $menu_item_data['menu-item-object'] ); 867 break; 864 868 } 865 869 866 870 $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); -
wp-admin/includes/nav-menu.php
59 59 } elseif ( 'post_type' == $item->type ) { 60 60 $original_object = get_post( $item->object_id ); 61 61 $original_title = $original_object->post_title; 62 } 62 } elseif ( 'archive' == $item->type ) { 63 $original_title = false; 64 } 63 65 64 66 $classes = array( 65 67 'menu-item menu-item-depth-' . $depth, … … 767 769 'url' => home_url('/'), 768 770 ) ); 769 771 } 772 } elseif ( $post_type['args']->has_archive ) { 773 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; 774 array_unshift( $posts, (object) array( 775 'ID' => 0, 776 'object' => $post_type_name, 777 'object_id' => $_nav_menu_placeholder, 778 'post_content' => '', 779 'post_excerpt' => '', 780 'post_parent' => '', 781 'post_title' => $post_type['args']->labels->items_archive, 782 'post_type' => 'nav_menu_item', 783 'type' => 'archive', 784 'url' => site_url( $post_type['args']->archive_slug ), 785 ) ); 770 786 } 771 787 772 788 $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type );