Skip to content

Instantly share code, notes, and snippets.

@deckerweb
Created March 25, 2012 18:16
Show Gist options
  • Save deckerweb/2198788 to your computer and use it in GitHub Desktop.
Save deckerweb/2198788 to your computer and use it in GitHub Desktop.
Genesis Toolbar Extras plugin v1.0+ -- filters and constants for customizing and branding
<?php
// since plugin version v1.0:
/** Capability filters & helper functions */
add_filter( 'gtbe_filter_capability_all', '__gtbe_admin_only' );
add_filter( 'gtbe_filter_capability_all', '__gtbe_role_editor' );
add_filter( 'gtbe_filter_capability_all', '__gtbe_cap_edit_theme_options' );
add_filter( 'gtbe_filter_capability_all', '__gtbe_cap_manage_options' );
add_filter( 'gtbe_filter_capability_all', '__gtbe_cap_install_plugins' );
add_filter( 'gtbe_filter_capability_all', 'custom_gtbe_capability_all' );
/**
* Genesis Toolbar Extras: Change Main Capability
*/
function custom_gtbe_capability_all() {
return 'switch_themes';
}
/** Icon (color) filters & helper functions */
add_filter( 'gtbe_filter_main_icon', '__gtbe_brown_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_darkblue_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_green_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_ivory_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_orange_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_pink_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_red_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_white_icon' );
add_filter( 'gtbe_filter_main_icon', '__gtbe_yellow_icon' );
add_filter( 'gtbe_filter_main_icon', 'custom_gtbe_main_icon' );
/**
* Genesis Toolbar Extras: Change Main Icon
*/
function custom_gtbe_main_icon() {
return get_stylesheet_directory_uri() . '/images/custom-icon.png';
}
/** Remove main icon completely */
add_filter( 'gtbe_filter_main_icon_display', '__gtbe_no_icon_display' );
add_filter( 'gtbe_filter_main_icon_display', 'custom_gtbe_main_icon_display_class' );
/**
* Genesis Toolbar Extras: Change Main Icon CSS Class
*/
function custom_gtbe_main_icon_display_class() {
return 'your-custom-icon-class';
}
add_filter( 'gtbe_filter_main_item', 'custom_gtbe_main_item' );
/**
* Genesis Toolbar Extras: Change Main Item Name
*/
function custom_gtbe_main_item() {
return __( 'Your custom main item', 'your-child-theme-textdomain' );
}
add_filter( 'gtbe_filter_main_item_tooltip', 'custom_gtbe_main_item_tooltip' );
/**
* Genesis Toolbar Extras: Change Main Item Name's Tooltip
*/
function custom_gtbe_main_item_tooltip() {
return __( 'Your custom main item tooltip', 'your-child-theme-textdomain' );
}
/**
* Filter: gtbe_filter_genesis_name
* Filter: gtbe_filter_genesis_name_tooltip
* For these 2 see the last two above - same principle/scheme
*/
//
// since plugin version v1.1:
//
/** Genesis Toolbar Extras: Add Theme Editor support */
add_theme_support( 'gtbe-theme-editor' );
/** Genesis Toolbar Extras: Custom Icon from Child Theme "images" folder (icon-gtbe.png 16x16 pixel) */
add_filter( 'gtbe_filter_main_icon', '__gtbe_child_images_icon' );
/** Genesis Toolbar Extras: Remove original Yoast SEO items */
define( 'GTBE_REMOVE_WPSEO_YOAST_TOOLBAR', true );
add_action( 'gtbe_custom_group_items', 'gtbe_custom_additional_group_item' );
/**
* Genesis Toolbar Extras: Custom Resource Group Items
*
* @global mixed $wp_admin_bar
*/
function gtbe_custom_additional_group_item() {
global $wp_admin_bar;
$wp_admin_bar->add_menu( array(
'parent' => 'ddw-genesis-genesisgroup',
'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: 'gtbe_custom_main_items'
* Child Theme section: 'gtbe_custom_theme_items'
* Extensions section: 'gtbe_custom_extend_items'
*/
//
// since plugin version 1.3:
//
add_filter( 'gtbe_filter_theme_support_url', 'custom_theme_support_url' );
/**
* Genesis Toolbar Extras: Custom Support URL
*/
function custom_theme_support_url() {
return 'http://genesisfinder.com/';
}
add_filter( 'gtbe_filter_theme_docs_url', 'custom_theme_docs_url' );
/**
* Genesis Toolbar Extras: Custom Docs URL
*/
function custom_theme_docs_url() {
return 'http://genesisfinder.com/';
}
add_filter( 'gtbe_filter_url_child_readme', 'custom_url_child_readme' );
/**
* Genesis Toolbar Extras: Custom README URL
*/
function custom_url_child_readme() {
return 'http://your-support-site.com/customers/readme.txt';
}
add_filter( 'gtbe_filter_url_child_changelog', 'custom_url_child_changelog' );
/**
* Genesis Toolbar Extras: Custom Changelog URL
*/
function custom_url_child_changelog() {
return 'http://your-theme-shop-site.com/theme-xy/changelog.txt';
}
//
// since plugin version 1.6.0:
//
/** Genesis Toolbar Extras: Remove My.StudioPress Items */
define( 'GTBE_MYSP_DISPLAY', FALSE );
/** Genesis Toolbar Extras: Remove my.StudioPress Items */
define( 'GTBE_OLDFORUMS_DISPLAY', FALSE );
@deckerweb
Copy link
Author

Note: The above codes work with plugin version 1.0 or higher!

Extended explanation can be found at the plugin's page "FAQ" section at the bottom:
http://wordpress.org/extend/plugins/genesis-toolbar-extras/faq/

Download "Genesis Toolbar Extras" plugin at wordpress.org:
http://wordpress.org/extend/plugins/genesis-toolbar-extras/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment