From 9007b1dd3aae0df60f72ef39b0ecbfa625b79d6e Mon Sep 17 00:00:00 2001 From: John James Jacoby Date: Tue, 2 Nov 2021 19:07:10 +0000 Subject: [PATCH] Help/About: add WordPress version to contextual "Help" sidebar area. This change adds a new way for users to quickly identify what version of WordPress they are looking at, directly from the "Help" sidebar on the main "Dashboard" page. * Stable versions will link to their respective support documents. * Development versions (alpha/beta/RC) will not link anywhere. Props audrasjb, costdev, donmhico, hellofromtonya, ipstenu, justinahinon, karmatosed, knutsp, marybaum, sergeybiryukov, webcommsat. Fixes #47848. git-svn-id: https://develop.svn.wordpress.org/trunk@51985 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/_index.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/_index.php b/src/wp-admin/_index.php index 4b4f149321ee..b21f7d7ce4bf 100644 --- a/src/wp-admin/_index.php +++ b/src/wp-admin/_index.php @@ -107,10 +107,30 @@ unset( $help ); +$wp_version = get_bloginfo( 'version', 'display' ); +$is_dev_version = preg_match( '/alpha|beta|RC/', $wp_version ); + +if ( $is_dev_version ) { + /* translators: %s. The WordPress version. */ + $wp_version_text = sprintf( __( 'Version %s' ), $wp_version ); +} else { + $wp_version_text = sprintf( + /* + * translators: + * 1. A link to the changelog ending with the WordPress version where '.' is replaced by '-'. + * 2. The WordPress version. + */ + __( 'Version %2$s' ), + esc_url( 'https://wordpress.org/support/wordpress-version/version-' . str_replace( '.', '-', $wp_version ) ), + $wp_version + ); +} + $screen->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . '

' . __( 'Documentation on Dashboard' ) . '

' . - '

' . __( 'Support' ) . '

' + '

' . __( 'Support' ) . '

' . + '

' . $wp_version_text . '

' ); require_once ABSPATH . 'wp-admin/admin-header.php';