Skip to content

Commit 7ec2c1d

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51022 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 849c811 commit 7ec2c1d

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

src/wp-admin/menu.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,22 @@
185185

186186
$appearance_cap = current_user_can( 'switch_themes' ) ? 'switch_themes' : 'edit_theme_options';
187187

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' );
188+
$menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
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' );
190204

191205
$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
192206
$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
@@ -236,7 +250,7 @@ function _add_themes_utility_last() {
236250
);
237251
}
238252

239-
/* translators: %s: Number of pending plugin updates. */
253+
/* translators: %s: Number of available plugin updates. */
240254
$menu[65] = array( sprintf( __( 'Plugins %s' ), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
241255

242256
$submenu['plugins.php'][5] = array( __( 'Installed Plugins' ), 'activate_plugins', 'plugins.php' );

0 commit comments

Comments
 (0)