Skip to content

Instantly share code, notes, and snippets.

@johnalarcon
Last active December 14, 2019 02:58
Show Gist options
  • Select an option

  • Save johnalarcon/fca74a4d7d1140bf64d22de72f146d5b to your computer and use it in GitHub Desktop.

Select an option

Save johnalarcon/fca74a4d7d1140bf64d22de72f146d5b to your computer and use it in GitHub Desktop.
Show current PHP version in ClassicPress admin bar
/**
* Add PHP version to ClassicPress admin bar.
*
* For environments in which the PHP version is subject to change, this will add
* the currently-running PHP version number to the admin bar to save some clicks
* and keep it immediately discoverable.
*
* @author John Alarcon
*/
function codepotent_adminbar_php_version() {
global $wp_admin_bar;
$wp_admin_bar->add_menu([
'parent' => false,
'id' => 'codepotent_adminbar_phpversion',
'title' => 'PHP '.phpversion()
]);
}
add_action('wp_before_admin_bar_render', 'codepotent_adminbar_php_version', PHP_INT_MAX);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment