Skip to content

Instantly share code, notes, and snippets.

@paulgoodchild
Created November 3, 2020 14:14
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 paulgoodchild/a5e39497a14cbfe90b76ff1860ec5a16 to your computer and use it in GitHub Desktop.
Save paulgoodchild/a5e39497a14cbfe90b76ff1860ec5a16 to your computer and use it in GitHub Desktop.
Customise the contents and styles of Shield Security Plugin Badge
<?php
/**
* The plugin badge array has 5 attributes represented by the following keys:
* name, url, logo, protected_by, custom_css
*
* This filter is only available is the plugin is activated for ShieldPRO.
*
* You may also use your Whitelabel settings to overwrite many of the defaults:
* See: https://icontrolwp.freshdesk.com/support/solutions/articles/3000078466
*/
add_filter( 'icwp_shield_plugin_badge_attributes', function ( $badgeAttributes, $isFloating ) {
/**
* Set the text to replace "This site is protected by Shield."
*/
$badgeAttributes[ 'protected_by' ] = 'Shield is keeping you safe';
/**
* Add custom CSS - e.g. set the background colour to yellow
*/
$badgeAttributes[ 'custom_css' ] = '#icwpWpsfSiteBadge{ background-color: yellow; }';
// ALWAYS return $badgeAttributes.
return $badgeAttributes;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment