Last active
October 2, 2015 04:37
-
-
Save deckerweb/2173193 to your computer and use it in GitHub Desktop.
WooCommerce Admin Bar Addition plugin version 2.2.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 */ | |
// Hooks: | |
add_action( 'wcaba_custom_group_items', 'wcaba_custom_additional_group_item' ); | |
/** | |
* BuddyPress Toolbar: Custom Resource Group Items | |
* | |
* @global mixed $wp_admin_bar | |
*/ | |
function wcaba_custom_additional_group_item() { | |
global $wp_admin_bar; | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'ddw-woocommerce-wcgroup', | |
'id' => 'your-unique-item-id', | |
'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 other hooks for adding new items: | |
* Main section: 'wcaba_custom_main_items' | |
* Extensions section: 'wcaba_custom_extend_items' | |
* Theme section: 'wcaba_custom_theme_items' | |
*/ | |
// Filters: | |
/** Capability filters & helper functions */ | |
add_filter( 'wcaba_filter_capability_all', '__wcaba_admin_only' ); | |
add_filter( 'wcaba_filter_capability_all', '__wcaba_role_shop_manager' ); | |
add_filter( 'wcaba_filter_capability_all', '__wcaba_role_editor' ); | |
add_filter( 'wcaba_filter_capability_all', '__wcaba_cap_manage_options' ); | |
add_filter( 'wcaba_filter_capability_all', '__wcaba_cap_install_plugins' ); | |
add_filter( 'wcaba_filter_capability_all', 'custom_wcaba_capability_all' ); | |
/** | |
* WooCommerce Admin Bar Addition: Change Main Capability | |
*/ | |
function custom_wcaba_capability_all() { | |
return 'edit_theme_options'; | |
} | |
/** Icon filters & helper functions */ | |
add_filter( 'wcaba_filter_main_icon', '__wcaba_blue_icon' ); | |
add_filter( 'wcaba_filter_main_icon', '__wcaba_grey_icon' ); | |
add_filter( 'wcaba_filter_main_icon', '__wcaba_orange_icon' ); | |
add_filter( 'wcaba_filter_main_icon', '__wcaba_pink_icon' ); | |
add_filter( 'wcaba_filter_main_icon', '__wcaba_red_icon' ); | |
add_filter( 'wcaba_filter_main_icon', '__wcaba_teal_icon' ); | |
add_filter( 'wcaba_filter_main_icon', 'custom_wcaba_main_icon' ); | |
/** | |
* WooCommerce Admin Bar Addition: Change Main Icon | |
*/ | |
function custom_wcaba_main_icon() { | |
return get_stylesheet_directory_uri() . '/images/custom-icon.png'; | |
} | |
/** Remove main icon completely */ | |
add_filter( 'wcaba_filter_main_icon_display', '__wcaba_no_icon_display' ); | |
add_filter( 'wcaba_filter_main_icon_display', 'custom_wcaba_main_icon_display_class' ); | |
/** | |
* WooCommerce Admin Bar Addition: Change Main Icon CSS Class | |
*/ | |
function custom_wcaba_main_icon_display_class() { | |
return 'your-custom-icon-class'; | |
} | |
add_filter( 'wcaba_filter_main_item', 'custom_wcaba_main_item' ); | |
/** | |
* WooCommerce Admin Bar Addition: Change Main Item Name | |
*/ | |
function custom_wcaba_main_item() { | |
return __( 'Your custom main item', 'your-theme-textdomain' ); | |
} | |
add_filter( 'wcaba_filter_main_item_tooltip', 'custom_wcaba_main_item_tooltip' ); | |
/** | |
* WooCommerce Admin Bar Addition: Change Main Item Name's Tooltip | |
*/ | |
function custom_wcaba_main_item_tooltip() { | |
return __( 'Your custom main item tooltip', 'your-theme-textdomain' ); | |
} | |
/** | |
* Filter: 'wcaba_filter_woocommerce_name' | |
* Filter: 'wcaba_filter_woocommerce_name_tooltip' | |
* For these 2 see the last two above - same principle/scheme | |
*/ | |
// Constants: | |
/** WooCommerce Admin Bar Addition: Remove ALL Items! */ | |
define( 'WCABA_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove Extensions Items */ | |
define( 'WCABA_EXTENSIONS_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove Themes Items */ | |
define( 'WCABA_THEMES_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove Resource Items */ | |
define( 'WCABA_RESOURCES_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove German Language Items */ | |
define( 'WCABA_DE_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove Dutch Language Items */ | |
define( 'WCABA_NL_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove WC Debug Link */ | |
define( 'WCABA_DEBUG_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove Reports/Statistics */ | |
define( 'WCABA_REPORTS_DISPLAY', FALSE ); | |
/** WooCommerce Admin Bar Addition: Remove all items for "Editor" user role */ | |
if ( current_user_can( 'editor' ) ) { | |
define( 'WCABA_DISPLAY', FALSE ); | |
} | |
/** WooCommerce Admin Bar Addition: Remove all items for user ID 2 */ | |
if ( 2 == get_current_user_id() ) { | |
define( 'WCABA_EXTENSIONS_DISPLAY', FALSE ); | |
} |
@designerken The plugin was just updated to v2.6.0 http://wordpress.org/plugins/woocommerce-admin-bar-addition/ Enjoy! :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How about an update to this little gem? Can the orders listing screen be added to the dropdown?