Created
September 11, 2012 10:58
-
-
Save admmssy/3697593 to your computer and use it in GitHub Desktop.
Wordpress Toolbar Tweak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Aston Toolbar Tweaks | |
| Description: Modify the wordpress toolbar | |
| Author: Adam Massey | |
| Author URI: https://twitter.com/admmssy | |
| */ | |
| function aston_toolbar_tweaks($wp_toolbar) { | |
| // remove the default wordpress menu | |
| $wp_toolbar->remove_node('wp-logo'); | |
| // yes, the non-breaking space and the base64 is a bodge. | |
| $title = ' <img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAALCAYAAAB/Ca1DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwOS8xMS8xMvmMvAsAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzQGstOgAAAAyElEQVQokZ2S0Q2CQBBEH8Z/LUErEDIFCBWIJVCJ0oFWICVYggWwCaXQAX5w6GlAwEkuuezdvN3sbtA0Df/KzDZA6E4MVMFUoJl1Rv+svC93ScflgDn2TBtgP5KvAjKAoCzLEEg9825SyW/VwFZSDdBVeHDAuaqBpIMBvHpoZifgPBOYSHr4gUV3kZQDEW0/pij7hn0AHbQCEuAyAsslFX0Pg2vjJn2jHZSvQlI2lOnnHprZ2kFTF6okRYOGMaAHTmnX6epPtE9PAIlEj07qEWoAAAAASUVORK5CYII=" /> '; | |
| if ( !is_user_logged_in() ) { | |
| $title .= ' Aston University Commons'; | |
| } else { | |
| $title .= ' Commons'; | |
| } | |
| $wp_toolbar->add_node(array( | |
| 'id' => 'aston', | |
| 'title' => $title, | |
| 'href' => network_home_url(), | |
| )); | |
| if ( is_user_logged_in() ) { | |
| $wp_toolbar->add_node(array( | |
| 'id' => 'activity', | |
| 'title' => 'Activity', | |
| 'parent' => 'aston', | |
| 'href' => network_home_url() . 'activity' | |
| )); | |
| $wp_toolbar->add_node(array( | |
| 'id' => 'groups', | |
| 'title' => 'Groups', | |
| 'parent' => 'aston', | |
| 'href' => network_home_url() . 'groups' | |
| )); | |
| $wp_toolbar->add_node(array( | |
| 'id' => 'sites', | |
| 'title' => 'Sites', | |
| 'parent' => 'aston', | |
| 'href' => network_home_url() . 'blogs' | |
| )); | |
| $wp_toolbar->add_node(array( | |
| 'id' => 'members', | |
| 'title' => 'Members', | |
| 'parent' => 'aston', | |
| 'href' => network_home_url() . 'members' | |
| )); | |
| $wp_toolbar->add_node(array( | |
| 'id' => 'help', | |
| 'title' => 'Help', | |
| 'parent' => 'aston', | |
| 'href' => network_home_url() . 'help' | |
| )); | |
| } | |
| } | |
| add_action('admin_bar_menu', 'aston_toolbar_tweaks', 11); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment