X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/dc1231b7312fbdca99e9e887cc2bb35a28f85cdc..refs/tags/wordpress-4.4:/wp-includes/class-wp-customize-nav-menus.php diff --git a/wp-includes/class-wp-customize-nav-menus.php b/wp-includes/class-wp-customize-nav-menus.php index fb1633bf..f6be2094 100644 --- a/wp-includes/class-wp-customize-nav-menus.php +++ b/wp-includes/class-wp-customize-nav-menus.php @@ -107,7 +107,8 @@ final class WP_Customize_Nav_Menus { $items = array(); if ( 'post_type' === $type ) { - if ( ! get_post_type_object( $object ) ) { + $post_type = get_post_type_object( $object ); + if ( ! $post_type ) { return new WP_Error( 'nav_menus_invalid_post_type' ); } @@ -121,6 +122,16 @@ final class WP_Customize_Nav_Menus { 'object' => '', 'url' => home_url(), ); + } elseif ( 'post' !== $object && 0 === $page && $post_type->has_archive ) { + // Add a post type archive link. + $items[] = array( + 'id' => $object . '-archive', + 'title' => $post_type->labels->archives, + 'type' => 'post_type_archive', + 'type_label' => __( 'Post Type Archive' ), + 'object' => $object, + 'url' => get_post_type_archive_link( $object ), + ); } $posts = get_posts( array( @@ -325,8 +336,8 @@ final class WP_Customize_Nav_Menus { 'untitled' => _x( '(no label)', 'missing menu item navigation label' ), 'unnamed' => _x( '(unnamed)', 'Missing menu name.' ), 'custom_label' => __( 'Custom Link' ), - /* translators: %s: Current menu location */ - 'menuLocation' => __( '(Currently set to: %s)' ), + /* translators: %s: menu location slug */ + 'menuLocation' => _x( '(Currently set to: %s)', 'menu' ), 'menuNameLabel' => __( 'Menu Name' ), 'itemAdded' => __( 'Menu item added' ), 'itemDeleted' => __( 'Menu item deleted' ), @@ -342,8 +353,6 @@ final class WP_Customize_Nav_Menus { 'invalidTitleTpl' => __( '%s (Invalid)' ), /* translators: %s: title of menu item in draft status */ 'pendingTitleTpl' => __( '%s (Pending)' ), - 'taxonomyTermLabel' => __( 'Taxonomy' ), - 'postTypeLabel' => __( 'Post Type' ), 'itemsFound' => __( 'Number of items found: %d' ), 'itemsFoundMore' => __( 'Additional items found: %d' ), 'itemsLoadingMore' => __( 'Loading more results... please wait.' ), @@ -464,10 +473,14 @@ final class WP_Customize_Nav_Menus { ) ) ); $menus = wp_get_nav_menus(); - // Menu loactions. + // Menu locations. $locations = get_registered_nav_menus(); $num_locations = count( array_keys( $locations ) ); - $description = '

' . sprintf( _n( 'Your theme contains %s menu location. Select which menu you would like to use.', 'Your theme contains %s menu locations. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ); + if ( 1 == $num_locations ) { + $description = '

' . __( 'Your theme supports one menu. Select which menu you would like to use.' ); + } else { + $description = '

' . sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ); + } $description .= '

' . __( 'You can also place menus in widget areas with the Custom Menu widget.' ) . '

'; $this->manager->add_section( 'menu_locations', array( @@ -611,7 +624,7 @@ final class WP_Customize_Nav_Menus { if ( $post_types ) { foreach ( $post_types as $slug => $post_type ) { $item_types[] = array( - 'title' => $post_type->labels->singular_name, + 'title' => $post_type->labels->name, 'type' => 'post_type', 'object' => $post_type->name, ); @@ -625,7 +638,7 @@ final class WP_Customize_Nav_Menus { continue; } $item_types[] = array( - 'title' => $taxonomy->labels->singular_name, + 'title' => $taxonomy->labels->name, 'type' => 'taxonomy', 'object' => $taxonomy->name, ); @@ -662,7 +675,7 @@ final class WP_Customize_Nav_Menus { - @@ -762,7 +775,7 @@ final class WP_Customize_Nav_Menus { -