Changeset 35382
- Timestamp:
- 10/24/2015 05:45:11 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r35371 r35382 1158 1158 case 'post_type' : 1159 1159 $_object = get_post( $menu_item_data['menu-item-object-id'] ); 1160 break; 1161 1162 case 'post_type_archive' : 1163 $_object = get_post_type_object( $menu_item_data['menu-item-object'] ); 1160 1164 break; 1161 1165 -
trunk/src/wp-admin/includes/class-walker-nav-menu-edit.php
r35202 r35382 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 -
trunk/src/wp-admin/includes/nav-menu.php
r35170 r35382 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 -
trunk/src/wp-includes/nav-menu-template.php
r34666 r35382 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'] ) ) { -
trunk/src/wp-includes/nav-menu.php
r34769 r35382 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 $original_object = get_post_type_object( $args['menu-item-object'] ); 408 $original_title = $original_object->labels->archives; 406 409 } 407 410 … … 732 735 $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; 733 736 737 } elseif ( 'post_type_archive' == $menu_item->type ) { 738 $object = get_post_type_object( $menu_item->object ); 739 if ( $object ) { 740 $menu_item->title = '' == $menu_item->post_title ? $object->labels->archives : $menu_item->post_title; 741 } else { 742 $menu_item->_invalid = true; 743 } 744 745 $menu_item->type_label = __( 'Post Type Archive' ); 746 $menu_item->description = ''; 747 $menu_item->url = get_post_type_archive_link( $menu_item->object ); 734 748 } elseif ( 'taxonomy' == $menu_item->type ) { 735 749 $object = get_taxonomy( $menu_item->object ); -
trunk/src/wp-includes/post-functions.php
r35377 r35382 1324 1324 * ones the default is 'Parent Page:'. 1325 1325 * - all_items - String for the submenu. Default is All Posts/All Pages. 1326 * - archives - String for use with archives in nav menus. Default is Post Archives/Page Archives. 1326 1327 * - insert_into_item - String for the media frame button. Default is Insert into post/Insert into page. 1327 1328 * - uploaded_to_this_item - String for the media frame filter. Default is Uploaded to this post/Uploaded to this page. … … 1363 1364 'parent_item_colon' => array( null, __('Parent Page:') ), 1364 1365 'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ), 1366 'archives' => array( __( 'Post Archives' ), __( 'Page Archives' ) ), 1365 1367 'insert_into_item' => array( __( 'Insert into post' ), __( 'Insert into page' ) ), 1366 1368 'uploaded_to_this_item' => array( __( 'Uploaded to this post' ), __( 'Uploaded to this page' ) ), … … 1428 1430 if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) 1429 1431 $object->labels['all_items'] = $object->labels['menu_name']; 1432 1433 if ( !isset( $object->labels['archives'] ) && isset( $object->labels['all_items'] ) ) { 1434 $object->labels['archives'] = $object->labels['all_items']; 1435 } 1430 1436 1431 1437 $defaults = array();
Note: See TracChangeset
for help on using the changeset viewer.