Customisation

Custom CSS

To disable the default CSS:

wp_dequeue_style('cookie-manager-ui');

Custom JavaScript

If you wish to customise the JavaScript, you can dequeue the plugin's version:

wp_dequeue_script('cookie-manager-ui');

Custom HTML Template

To customise the template HTML, copy files from templates/ into your theme's root directory and apply your customisations.

The default JavaScript will bind to the template in the following ways:

Selector Scope Description
#cookie-manager template This should be the top level element for the UI. The JS will toggle the .open class based on state.
[data-handle] template An element tied to a specific tracker, the value should be the handle of the tracker - this will have both the data-state attribute toggled based on cookie state and either .cookie-allow or .cookie-block classes added
[data-action="allow-all"] template Allows all cookies on click
[data-action="reject-all"] template Rejects all cookies on click
[data-action="opt-in"] template Allow specific cookie (specified by [data-handle])
[data-action="opt-out"] template Reject specific cookie (specified by [data-handle])
[data-action="toggle"] template Toggle specific cookie (specified by [data-handle])
[data-action="close"] template Close cookie UI
[data-action="cookie-settings"] global Display cookie UI on click

e.g. To trigger the cookie settings popup on click, add the attribute data-action="cookie-settings" to any HTML tag

To trigger it via JavaScript instead, call CookieManagerUI.showBanner().