Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A shortcode to show content if cookies are not accepted
<?php /* Shortcode Cookie Not Accepted */
function custom_cn_cookies_not_accepted( $atts, $content = null ) {
if (function_exists('cn_cookies_accepted') && !cn_cookies_accepted()) {
return '<div class="box cookie-box">' . do_shortcode($content) . '</div>';
} else {
return '';
add_shortcode('cookies_not_accepted', 'custom_cn_cookies_not_accepted');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment