wp/wp-admin/menu.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
   183 
   183 
   184 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
   184 $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
   185 
   185 
   186 $appearance_cap = current_user_can( 'switch_themes' ) ? 'switch_themes' : 'edit_theme_options';
   186 $appearance_cap = current_user_can( 'switch_themes' ) ? 'switch_themes' : 'edit_theme_options';
   187 
   187 
   188 $menu[60]                     = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
   188 $menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
   189 	$submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
   189 
       
   190 $count = '';
       
   191 if ( ! is_multisite() && current_user_can( 'update_themes' ) ) {
       
   192 	if ( ! isset( $update_data ) ) {
       
   193 		$update_data = wp_get_update_data();
       
   194 	}
       
   195 	$count = sprintf(
       
   196 		'<span class="update-plugins count-%s"><span class="theme-count">%s</span></span>',
       
   197 		$update_data['counts']['themes'],
       
   198 		number_format_i18n( $update_data['counts']['themes'] )
       
   199 	);
       
   200 }
       
   201 
       
   202 	/* translators: %s: Number of available theme updates. */
       
   203 	$submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' );
   190 
   204 
   191 	$customize_url            = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
   205 	$customize_url            = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
   192 	$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
   206 	$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
   193 
   207 
   194 if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
   208 if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
   207 
   221 
   208 	unset( $customize_url );
   222 	unset( $customize_url );
   209 
   223 
   210 unset( $appearance_cap );
   224 unset( $appearance_cap );
   211 
   225 
   212 // Add 'Editor' to the bottom of the Appearance menu.
   226 // Add 'Theme Editor' to the bottom of the Appearance menu.
   213 if ( ! is_multisite() ) {
   227 if ( ! is_multisite() ) {
   214 	add_action( 'admin_menu', '_add_themes_utility_last', 101 );
   228 	add_action( 'admin_menu', '_add_themes_utility_last', 101 );
   215 }
   229 }
   216 /**
   230 /**
   217  * Adds the (theme) 'Editor' link to the bottom of the Appearance menu.
   231  * Adds the 'Theme Editor' link to the bottom of the Appearance menu.
   218  *
   232  *
   219  * @access private
   233  * @access private
   220  * @since 3.0.0
   234  * @since 3.0.0
   221  */
   235  */
   222 function _add_themes_utility_last() {
   236 function _add_themes_utility_last() {
   234 		$update_data['counts']['plugins'],
   248 		$update_data['counts']['plugins'],
   235 		number_format_i18n( $update_data['counts']['plugins'] )
   249 		number_format_i18n( $update_data['counts']['plugins'] )
   236 	);
   250 	);
   237 }
   251 }
   238 
   252 
   239 /* translators: %s: Number of pending plugin updates. */
   253 /* translators: %s: Number of available plugin updates. */
   240 $menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
   254 $menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
   241 
   255 
   242 $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' );
   256 $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' );
   243 
   257 
   244 if ( ! is_multisite() ) {
   258 if ( ! is_multisite() ) {