Last active
October 3, 2015 20:18
-
-
Save deckerweb/2519992 to your computer and use it in GitHub Desktop.
Xtreme One Toolbar plugin version 1.1.0 or higher -- filters and constants for customizing and branding
This file contains 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 | |
/** Do NOT include the opening php tag */ | |
// since plugin version v1.1.0: | |
// Hooks: | |
add_action( 'xotb_custom_group_items', 'xotb_custom_additional_group_item' ); | |
/** | |
* Xtreme One Toolbar: Custom Resource Group Items | |
* | |
* @global mixed $wp_admin_bar | |
*/ | |
function xotb_custom_additional_group_item() { | |
global $wp_admin_bar; | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'ddw-xtreme-xobar', | |
'title' => __( 'Custom Menu Item Name', 'your-textdomain' ), | |
'href' => 'http://deckerweb.de/', | |
'meta' => array( 'title' => __( 'Custom Menu Item Name Tooltip', 'your-textdomain' ) ) | |
) ); | |
} | |
/** | |
* The same way you can use the hook 'xotb_custom_main_items' for adding main items! | |
*/ | |
// Filters: | |
/** Capability filters & helper functions */ | |
add_filter( 'xotb_filter_capability_all', '__xotb_admin_only' ); | |
add_filter( 'xotb_filter_capability_all', '__xotb_role_editor' ); | |
add_filter( 'xotb_filter_capability_all', '__xotb_cap_edit_theme_options' ); | |
add_filter( 'xotb_filter_capability_all', '__xotb_cap_install_plugins' ); | |
add_filter( 'xotb_filter_capability_all', 'custom_xotb_capability_all' ); | |
/** | |
* Xtreme One Toolbar: Change Main Capability | |
*/ | |
function custom_xotb_capability_all() { | |
return 'switch_themes'; | |
} | |
add_filter( 'xotb_filter_main_icon', 'custom_xotb_main_icon' ); | |
/** | |
* Xtreme One Toolbar: Change Main Icon | |
*/ | |
function custom_xotb_main_icon() { | |
return get_stylesheet_directory_uri() . '/images/custom-icon.png'; | |
} | |
/** 10 Colored Icon filters & helper functions */ | |
add_filter( 'xotb_filter_main_icon', '__xotb_blue_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_gray_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_green_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_khaki_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_orange_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_pink_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_red_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_tan_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_turquoise_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_yellow_icon' ); | |
add_filter( 'xotb_filter_main_icon', '__xotb_child_images_icon' ); | |
/** | |
* Custom Icon filter & helper function | |
* via child theme "images" folder (file: icon-xotb.png) | |
*/ | |
add_filter( 'xotb_filter_main_icon', '__xotb_child_images_icon' ); | |
add_filter( 'xotb_filter_main_icon_display', 'custom_xotb_main_icon_display_class' ); | |
/** | |
* Xtreme One Toolbar: Change Main Icon CSS Class | |
*/ | |
function custom_xotb_main_icon_display_class() { | |
return 'your-custom-icon-class'; | |
} | |
/** Remove main icon completely */ | |
add_filter( 'xotb_filter_main_icon_display', '__xotb_no_icon_display' ); | |
add_filter( 'xotb_filter_main_item', 'custom_xotb_main_item' ); | |
/** | |
* Xtreme One Toolbar: Change Main Item Name | |
*/ | |
function custom_xotb_main_item() { | |
return __( 'Your custom main item', 'your-child-theme-textdomain' ); | |
} | |
add_filter( 'xotb_filter_main_item_tooltip', 'custom_xotb_main_item_tooltip' ); | |
/** | |
* Xtreme One Toolbar: Change Main Item Name's Tooltip | |
*/ | |
function custom_xotb_main_item_tooltip() { | |
return __( 'Your custom main item tooltip', 'your-child-theme-textdomain' ); | |
} | |
/** | |
* Filter: xotb_filter_xtreme_name | |
* Filter: xotb_filter_xtreme_name_tooltip | |
* For these 2 see the last two above - same principle/scheme | |
*/ | |
// Constants: | |
/** Xtreme One Toolbar: Remove All Items */ | |
define( 'XOTB_DISPLAY', FALSE ); | |
/** Xtreme One Toolbar: Remove Theme Items */ | |
define( 'XOTB_THEME_DISPLAY', FALSE ); | |
/** Xtreme One Toolbar: Remove Extensions Items */ | |
define( 'XOTB_EXTENSIONS_DISPLAY', FALSE ); | |
/** Xtreme One Toolbar: Remove Resource Items */ | |
define( 'XOTB_RESOURCES_DISPLAY', FALSE ); | |
/** Xtreme One Toolbar: Remove German Language Items */ | |
define( 'XOTB_DE_DISPLAY', FALSE ); | |
/** Xtreme One Toolbar: Remove all items for "Editor" user role */ | |
if ( current_user_can( 'editor' ) ) { | |
define( 'XOTB_DISPLAY', FALSE ); | |
} | |
/** Xtreme One Toolbar: Remove all items for user ID 2 */ | |
if ( 2 == get_current_user_id() ) { | |
define( 'XOTB_DISPLAY', FALSE ); | |
} | |
/** Xtreme One Toolbar: Remove all items from frontend */ | |
if ( ! is_admin() ) { | |
define( 'XOTB_DISPLAY', FALSE ); | |
} | |
/** Xtreme One Toolbar: Remove original Yoast SEO items */ | |
define( 'XOTB_REMOVE_WPSEO_YOAST_TOOLBAR', true ); | |
// Other Stuff: | |
/** Xtreme One Toolbar: Remove the 'Xtreme News' Dashboard widget */ | |
add_action( 'init', '__xotb_remove_xtreme_dashboard_widget' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: The above codes work with plugin version 1.1.0 or higher!
Extended explanation can be found at the plugin's page "FAQ" section at the bottom:
http://wordpress.org/plugins/xtreme-one-toolbar/faq/
Download "Xtreme One Toolbar" plugin at wordpress.org:
http://wordpress.org/plugins/xtreme-one-toolbar/