• Resolved xroox

    (@xroox)


    Hi friends!

    I recently came across this page with details on how to hide the banner on certain pages. I’d like to do the opposite: only show the banner on certain pages.

    I tried modifying the code given to the below, but it doesn’t seem to be working for me. Perhaps you could correct my mistake?

    add_filter('cli_show_cookie_bar_only_on_selected_pages', 'webtoffee_custom_selected_pages', 10, 2);
    
    function webtoffee_custom_selected_pages($html, $slug) {
    
        $slug_array = array('manage-cookies');
        if (!in_array($slug, $slug_array)) {
            $html = '';
            return $html;
        }
    
        // For wild card URL entry
        foreach ($slug_array as $slug_ar) {
            if (strpos($slug_ar, '*') !== false) {
    
                if (fnmatch($slug_ar, $slug)) {
                    $html = '';
                    return $html;
                }
            }
        }
    
        return $html;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support CookieYes Team

    (@cookieyesteam)

    Hi @xroox,

    Greetings from CookieYes!

    We would like to know your site URL and configuration to better assist you. Will you be able to share it privately via this link?

    Thread Starter xroox

    (@xroox)

    Hi sorry for the delay – thank you I have sent the info via the form on the page you sent!

    Plugin Support CookieYes Team

    (@cookieyesteam)

    Hi @xroox,

    It appears that you are currently using the revamped plugin. However, the code snippet you tested is only compatible with our legacy version. To remove the banner from specific pages, please access the site settings on your web app dashboard.

    Kindly be advised that to access this feature, it is required to upgrade to a pro plan.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Show only on certain pages’ is closed to new replies.