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
This commit is contained in:
Sergey Biryukov 2021-05-26 01:17:57 +00:00
parent 56ca42b5d9
commit d7086ba67a
2 changed files with 18 additions and 4 deletions

View File

@ -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(
'<span class="update-plugins count-%s"><span class="theme-count">%s</span></span>',
$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' );

View File

@ -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.