Below, you’ll find a detailed guide on how to add the GDPR Compliance & Cookie Consent 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 GDPR Compliance & Cookie Consent Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the GDPR Compliance & Cookie Consent Plugin and the shortcodes it provides:
"GDPR Compliance & Cookie Consent is a plugin that helps your website meet GDPR regulations. It manages user consent and ensures cookie usage transparency."
- [stm-gpdr-data-access]
GDPR Compliance & Cookie Consent [stm-gpdr-data-access] Shortcode
The ‘stm-gpdr-data-access’ shortcode is part of the GDPR Compliance Cookie Consent plugin. It generates a form that allows users to request access to or deletion of their personal data, ensuring GDPR compliance.
Shortcode: [stm-gpdr-data-access]
Examples and Usage
Basic example – A shortcode that enables GDPR data access requests on your site.
[stm-gpdr-data-access]
PHP Function Code
In case you have difficulties debugging what causing issues with [stm-gpdr-data-access]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('stm-gpdr-data-access', array(STM_DataAccess::getInstance(), 'stm_gdpr_shortcode'));
Shortcode PHP function:
function stm_gdpr_shortcode( $args ) {
ob_start(); ?>
<form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post" id="stm-gpdr-form">
<p>
<label for="stm_gpdr"><?php esc_html_e('Email address (*)', 'gdpr-compliance-cookie-consent'); ?></label>
<input type="email" id="stm_gpdr_data_email" class="<?php echo STM_Helpers::stm_helpers_cmb_get_option(STM_GDPR_PREFIX . 'data_access', 'input-class'); ?>" name="stm_gpdr_data_email" required/>
</p>
<p>
<input id="stm_gpdr_type_export" type="radio" name="stm_gpdr_data_type" value="export_personal_data" checked="checked" required/>
<label for="stm_gpdr_type_export"><?php esc_html_e('Export Personal Data', 'gdpr-compliance-cookie-consent'); ?></label>
<br />
<input id="stm_gpdr_type_remove" type="radio" name="stm_gpdr_data_type" value="remove_personal_data" required />
<label for="stm_gpdr_type_remove"><?php esc_html_e('Erase Personal Data', 'gdpr-compliance-cookie-consent'); ?></label>
</p>
<p>
<input type="submit" class="<?php echo STM_Helpers::stm_helpers_cmb_get_option(STM_GDPR_PREFIX . 'data_access', 'button-class'); ?>" value="<?php esc_attr_e('Send request', 'gdpr-compliance-cookie-consent'); ?>" />
</p>
</form>
<?php return ob_get_clean();
}
Code file location:
gdpr-compliance-cookie-consent/gdpr-compliance-cookie-consent/gdpr-compliance-cookie-consent.php
Conclusion
Now that you’ve learned how to embed the GDPR Compliance & Cookie Consent 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.
Leave a Reply