Cookie Notice And Consent Banner Shortcode

Below, you’ll find a detailed guide on how to add the Cookie Notice And Consent Banner Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Cookie Notice And Consent Banner Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Cookie Notice And Consent Banner Plugin and the shortcodes it provides:

Plugin Icon
Cookie Notice & Consent Banner for GDPR & CCPA Compliance

"Cookie Notice & Consent Banner for GDPR & CCPA Compliance is a WordPress plugin designed to help websites comply with international privacy laws. It manages user consent and customizes cookie notices."

★★★★✩ (11) Active Installs: 3000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [revoke_consent]

Cookie Notice And Consent Banner [revoke_consent] Shortcode

The ‘Revoke Consent’ shortcode is a part of the cookie-notice-and-consent-banner plugin. It allows users to withdraw their previously given consent for cookies. This shortcode displays a clickable text link. The link’s default text is ‘Revoke Consent’, but it can be customized using the ‘text’ attribute. When clicked, the link triggers the plugin’s function to restore the cookie consent banner.

Shortcode: [revoke_consent]

Parameters

Here is a list of all possible revoke_consent shortcode parameters and attributes:

  • text – Defines the displayed text on the consent revoke link

Examples and Usage

Basic example – The shortcode is used to add a “Revoke Consent” link to a page or post. The link text can be customized by adding the ‘text’ attribute to the shortcode.

[revoke_consent /]

PHP Function Code

In case you have difficulties debugging what causing issues with [revoke_consent] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'revoke_consent', array( $this, 'add_revoke_shortcode' ) );

Shortcode PHP function:

function add_revoke_shortcode( $atts ){

            $text = 'Revoke Consent';

            if(isset($atts['text'])) {
                $text = $atts['text'];
            }
            return '<a href="#" class="cncb-js-restore">'. $text .'</a>';

        }

Code file location:

cookie-notice-and-consent-banner/cookie-notice-and-consent-banner/class-cncb-main.php

Conclusion

Now that you’ve learned how to embed the Cookie Notice And Consent Banner Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *