Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niraj-shah/9052026 to your computer and use it in GitHub Desktop.
Save niraj-shah/9052026 to your computer and use it in GitHub Desktop.
WordPress Plugin to Customise Toolbar
<?php
/**
* @package MyToolbar
*/
/*
Plugin Name: MyToolbar
Plugin URI: http://www.webniraj.com
Description: This plugin creates a custom toolbar
Version: 1.0
Author: Niraj Shah
Author URI: http://www.webniraj.com/wordpress/
*/
// function to run before menu is rendered
add_action( 'wp_before_admin_bar_render', 'preload_my_toolbar' );
// function to add items to toolbar
add_action( 'admin_bar_menu', 'my_toolbar' );
// forces toolbar to show to all users
add_filter( 'show_admin_bar', '__return_true' );
// placeholder function
function preload_my_toolbar() {
global $wp_admin_bar;
}
// placeholder function
function my_toolbar() {
global $wp_admin_bar;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment