Snippets
Components
Branding
Hide
Hide WPMUDEV hero images
Custom image
Change WPMUDEV hero images with user uploaded image. If there are multiple WPMUDEV hero images in a single plugin page, user uploaded image only applicable on Top Main section of the page, if plugin use SUI, its usually the one that uses sui-summary
css class (https://wpmudev.github.io/shared-ui/#summary). Other images that are not on Top Main section will be hidden in this case.
Footer
Custom Text
Change WPMUDEV footer, this is usually Made with 🖤 by WPMUDEV
and links that are below this text (if available). https://wpmudev.github.io/shared-ui/#footer. Custom text can be empty text means hide WPMUDEV footer altogether.
Documentation Link
Hide
Hide any link that refers to WPMUDEV documentation page.
Implementation
Manually
wpmudev_branding_hide_branding
It will return boolean
, whether use enabled Custom branding or not.
Usage :
<?php
$hide_branding = apply_filters( 'wpmudev_branding_hide_branding', false );
if ( !$hide_branding) {
echo "DISPLAY WPMUDEV DEFAULT HERO IMAGES";
}
wpmudev_branding_hero_image
It will return string
, url of user uploaded image
Usage :
<?php
$custom_hero_image = apply_filters( 'wpmudev_branding_hero_image', '' );
if ( !empty( $custom_hero_image ) ) {
echo "CHANGE WPMUDEV DEFAULT HERO IMAGE TO : " . $custom_hero_image;
}
wpmudev_branding_footer_text
It will return string
, footer text to be used.
Usage :
<?php
$footer_text = apply_filters( 'wpmudev_branding_footer_text', 'Made with <i>love</i> by WPMUDEV' );
echo "<footer>$footer_text</footer>"
wpmudev_branding_hide_doc_link
It will return boolean
, whether documentation link should be hidden or not.
Usage :
<?php
$hide_doc_link = apply_filters( 'wpmudev_branding_hide_doc_link', false );
if ( !$hide_doc_link) {
echo "HIDE WPMUDEV DOCUMENTATION LINK";
}
Built-in (for plugins using SUI below 2.3.18)
Built in solutuion are for those already using SUI, this solution is built on top of JS/CSS script. Although this solutions is built to be compatible to plugins that using SUI it might be lack of forward compatibilty (i.e SUI markup changes or different implementation of markup tree). These functions are available to implement whitelabel:
wpmudev_whitelabel_sui_plugins_branding
Whitelabel-ing Dashboard Hero image WPMUDev plugins that using SharedUI (sui) as basewpmudev_whitelabel_sui_plugins_footer
Whitelabel-ing Footer WPMUDev plugins that using SharedUI (sui) as basewpmudev_whitelabel_sui_plugins_doc_links
Whitelabel-ing Docs buttons WPMUDev plugins that using SharedUI (sui) as base
These function does not return anything, when this function called it will output sets of JS/CSS code to implement whitelabel.
Beside those 3 functions wpmudev_whitelabel_plugin_pages
wp filter
also available. What this filter does is take an array with key
is WP_Screen.base and values
are callable functions to be executed when the page rendered.
Usage :
<?php
add_filter( 'wpmudev_whitelabel_plugin_pages', function( $plugin_pages ){
$plugin_pages['toplevel_page-myplugin'] = array(
'wpmudev_whitelabel_sui_plugins_branding',
'wpmudev_whitelabel_sui_plugins_footer',
'wpmudev_whitelabel_sui_plugins_doc_links',
'my_custom_whitelabel_function',
);
$plugin_pages['myplugin-settings'] = array(
'wpmudev_whitelabel_sui_plugins_branding',
'wpmudev_whitelabel_sui_plugins_footer',
'wpmudev_whitelabel_sui_plugins_doc_links',
'my_custom_whitelabel_function',
);
return $plugin_pages;
});
In above example we are whitelabeling myplugin
plugins pages (dashboard and settings), myplugin-settings
is depends on how you register your plugin page, check add_menu_page
and add_submenu_page
. And on both pages we execute built in functions to implement whitelabel and call one more function my_custom_whitelabel_function
.
Despite its simplicity, you might want to implement Manual implementation anyway, since its recommended and you will gain more control how to whitelabel your plugins.
Comments (0)
You can clone a snippet to your computer for local editing. Learn more.