Skip to content

Instantly share code, notes, and snippets.

@JustinSainton
Created April 22, 2015 23:43
Show Gist options
  • Select an option

  • Save JustinSainton/613164292fd88f0f3c0d to your computer and use it in GitHub Desktop.

Select an option

Save JustinSainton/613164292fd88f0f3c0d to your computer and use it in GitHub Desktop.
Print current plugin branch to admin bar
<?php
public function admin_bar_menu() {
global $wp_admin_bar;
$plugin_path = ABSPATH . 'wp-content/plugins/WP-e-Commerce';
exec( 'cd ' . $plugin_path . ' && git rev-parse --abbrev-ref HEAD', $output, $return );
$wp_admin_bar->add_menu( array(
'id' => 'wpec-branch',
'title' => $output[0],
'href' => false ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment