wp/wp-includes/class-wp-customize-nav-menus.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   247 					'id'         => "post-{$post->ID}",
   247 					'id'         => "post-{$post->ID}",
   248 					'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   248 					'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   249 					'type'       => 'post_type',
   249 					'type'       => 'post_type',
   250 					'type_label' => $post_type_label,
   250 					'type_label' => $post_type_label,
   251 					'object'     => $post->post_type,
   251 					'object'     => $post->post_type,
   252 					'object_id'  => intval( $post->ID ),
   252 					'object_id'  => (int) $post->ID,
   253 					'url'        => get_permalink( intval( $post->ID ) ),
   253 					'url'        => get_permalink( (int) $post->ID ),
   254 				);
   254 				);
   255 			}
   255 			}
   256 		} elseif ( 'taxonomy' === $type ) {
   256 		} elseif ( 'taxonomy' === $type ) {
   257 			$terms = get_terms(
   257 			$terms = get_terms(
   258 				array(
   258 				array(
   279 					'id'         => "term-{$term->term_id}",
   279 					'id'         => "term-{$term->term_id}",
   280 					'title'      => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   280 					'title'      => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   281 					'type'       => 'taxonomy',
   281 					'type'       => 'taxonomy',
   282 					'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
   282 					'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
   283 					'object'     => $term->taxonomy,
   283 					'object'     => $term->taxonomy,
   284 					'object_id'  => intval( $term->term_id ),
   284 					'object_id'  => (int) $term->term_id,
   285 					'url'        => get_term_link( intval( $term->term_id ), $term->taxonomy ),
   285 					'url'        => get_term_link( (int) $term->term_id, $term->taxonomy ),
   286 				);
   286 				);
   287 			}
   287 			}
   288 		}
   288 		}
   289 
   289 
   290 		/**
   290 		/**
   408 				'id'         => 'post-' . $post->ID,
   408 				'id'         => 'post-' . $post->ID,
   409 				'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   409 				'title'      => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   410 				'type'       => 'post_type',
   410 				'type'       => 'post_type',
   411 				'type_label' => $post_type_label,
   411 				'type_label' => $post_type_label,
   412 				'object'     => $post->post_type,
   412 				'object'     => $post->post_type,
   413 				'object_id'  => intval( $post->ID ),
   413 				'object_id'  => (int) $post->ID,
   414 				'url'        => get_permalink( intval( $post->ID ) ),
   414 				'url'        => get_permalink( (int) $post->ID ),
   415 			);
   415 			);
   416 		}
   416 		}
   417 
   417 
   418 		// Query taxonomy terms.
   418 		// Query taxonomy terms.
   419 		$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
   419 		$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
   434 					'id'         => 'term-' . $term->term_id,
   434 					'id'         => 'term-' . $term->term_id,
   435 					'title'      => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   435 					'title'      => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ),
   436 					'type'       => 'taxonomy',
   436 					'type'       => 'taxonomy',
   437 					'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
   437 					'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name,
   438 					'object'     => $term->taxonomy,
   438 					'object'     => $term->taxonomy,
   439 					'object_id'  => intval( $term->term_id ),
   439 					'object_id'  => (int) $term->term_id,
   440 					'url'        => get_term_link( intval( $term->term_id ), $term->taxonomy ),
   440 					'url'        => get_term_link( (int) $term->term_id, $term->taxonomy ),
   441 				);
   441 				);
   442 			}
   442 			}
   443 		}
   443 		}
   444 
   444 
   445 		// Add "Home" link if search term matches. Treat as a page, but switch to custom on add.
   445 		// Add "Home" link if search term matches. Treat as a page, but switch to custom on add.
   486 
   486 
   487 		$temp_nav_menu_setting      = new WP_Customize_Nav_Menu_Setting( $this->manager, 'nav_menu[-1]' );
   487 		$temp_nav_menu_setting      = new WP_Customize_Nav_Menu_Setting( $this->manager, 'nav_menu[-1]' );
   488 		$temp_nav_menu_item_setting = new WP_Customize_Nav_Menu_Item_Setting( $this->manager, 'nav_menu_item[-1]' );
   488 		$temp_nav_menu_item_setting = new WP_Customize_Nav_Menu_Item_Setting( $this->manager, 'nav_menu_item[-1]' );
   489 
   489 
   490 		$num_locations = count( get_registered_nav_menus() );
   490 		$num_locations = count( get_registered_nav_menus() );
       
   491 
   491 		if ( 1 === $num_locations ) {
   492 		if ( 1 === $num_locations ) {
   492 			$locations_description = __( 'Your theme can display menus in one location.' );
   493 			$locations_description = __( 'Your theme can display menus in one location.' );
   493 		} else {
   494 		} else {
   494 			/* translators: %s: Number of menu locations. */
   495 			/* translators: %s: Number of menu locations. */
   495 			$locations_description = sprintf( _n( 'Your theme can display menus in %s location.', 'Your theme can display menus in %s locations.', $num_locations ), number_format_i18n( $num_locations ) );
   496 			$locations_description = sprintf( _n( 'Your theme can display menus in %s location.', 'Your theme can display menus in %s locations.', $num_locations ), number_format_i18n( $num_locations ) );
   677 		$menus = wp_get_nav_menus();
   678 		$menus = wp_get_nav_menus();
   678 
   679 
   679 		// Menu locations.
   680 		// Menu locations.
   680 		$locations     = get_registered_nav_menus();
   681 		$locations     = get_registered_nav_menus();
   681 		$num_locations = count( $locations );
   682 		$num_locations = count( $locations );
   682 		if ( 1 == $num_locations ) {
   683 
       
   684 		if ( 1 === $num_locations ) {
   683 			$description = '<p>' . __( 'Your theme can display menus in one location. Select which menu you would like to use.' ) . '</p>';
   685 			$description = '<p>' . __( 'Your theme can display menus in one location. Select which menu you would like to use.' ) . '</p>';
   684 		} else {
   686 		} else {
   685 			/* translators: %s: Number of menu locations. */
   687 			/* translators: %s: Number of menu locations. */
   686 			$description = '<p>' . sprintf( _n( 'Your theme can display menus in %s location. Select which menu you would like to use.', 'Your theme can display menus in %s locations. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>';
   688 			$description = '<p>' . sprintf( _n( 'Your theme can display menus in %s location. Select which menu you would like to use.', 'Your theme can display menus in %s locations. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>';
   687 		}
   689 		}