From d7086ba67a3071b26678b11f8f12f8f7c3f78484 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 26 May 2021 01:17:57 +0000 Subject: [PATCH] Themes: Display the number of available theme updates in the admin menu. This brings some consistency with the similar update counter for plugins. Props mukesh27, zodiac1978, pixolin, Boniu91, francina, sannevndrmeulen, joyously, SergeyBiryukov. Fixes #43697. Built from https://develop.svn.wordpress.org/trunk@51022 git-svn-id: http://core.svn.wordpress.org/trunk@50631 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/menu.php | 20 +++++++++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 9b479da344..20a0a2f477 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -185,8 +185,22 @@ $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' ); $appearance_cap = current_user_can( 'switch_themes' ) ? 'switch_themes' : 'edit_theme_options'; -$menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' ); - $submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' ); +$menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' ); + +$count = ''; +if ( ! is_multisite() && current_user_can( 'update_themes' ) ) { + if ( ! isset( $update_data ) ) { + $update_data = wp_get_update_data(); + } + $count = sprintf( + '%s', + $update_data['counts']['themes'], + number_format_i18n( $update_data['counts']['themes'] ) + ); +} + + /* translators: %s: Number of available theme updates. */ + $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' ); $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' ); $submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' ); @@ -236,7 +250,7 @@ if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) { ); } -/* translators: %s: Number of pending plugin updates. */ +/* translators: %s: Number of available plugin updates. */ $menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' ); $submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index e96e7d0d21..2692dc95ce 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-51021'; +$wp_version = '5.8-alpha-51022'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.