hit10
Forum Replies Created
-
Thanks @formidablematthew …I already have the code snippets plugin installed so have used that option to put the code fix in.
Just hope it works!
That has worked! Thank you @rogierlankhorst
For anyone else, I used a plugin called ‘code snippets’ which is very useful in general as an alternative to the mu-plugin method. The final full code I used that worked is:
<?php
/**
* Filter post types for cookiewarning
* It's too early to use global $post or url_to_postid(), so we do a simple text comparison
* @param $cookiewarning_required
* @return bool
*/
function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required) {
$url = (is_ssl() ? "https" : "http") . "://" .$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
if ( strpos($url, 'links') !== FALSE ) {
$cookiewarning_required = false;
}
return $cookiewarning_required;
}
add_filter('cmplz_site_needs_cookiewarning',
'cmplz_my_filter_site_needs_cookiewarning');Yes certainly, this is the code
<?php
/**
* Filter post types for cookiewarning
* It's too early to use global $post or url_to_postid(), so we do a simple text comparison
* @param $cookiewarning_required
* @return bool
*/
function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required) {
$url = (is_ssl() ? "https" : "http") . "://" .$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
if ( strpos($url, 'links') !== FALSE ) {
$cookiewarning_required = false;
}
return $cookiewarning_required;
}
I’ve been clearing the cache each time as I thought it could be that, but it isn’t.
I tried your suggestion, I already have an MU-Plugin directory and added the php file as per the instructions above. But that made me site crash so I removed it.
I have a code snippets plugin so I tried adding the code in there. The code was accepted but didn’t make a difference either.
Hi @aahulsebos yes, that is the code I have put in and ‘links’ is the slug I have put in that code.
I have put it in the functions.php file. But the cookie banner still shows up. What am I doing wrong?
Ok, so I added this code in my functions.php file but still didn’t work. Is it because I put it in functions.php?
/**
* Filter post types for cookiewarning
* It's too early to use global $post or url_to_postid(), so we do a simple text comparison
* @param $cookiewarning_required
*
* @return bool
*/
function cmplz_my_filter_site_needs_cookiewarning( $cookiewarning_required
) {
$url = (is_ssl() ? "https"
: "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";if ( strpos($url, 'links') !== FALSE ) {
$cookiewarning_required = false;
}return $cookiewarning_required;
}
add_filter( 'cmplz_site_needs_cookiewarning', 'cmplz_my_filter_site_needs_cookiewarning' );- This reply was modified 5 years, 10 months ago by hit10.
I’m sorry @rogierlankhorst but is this in response to my query or to the other people who have added their own queries in my post?
To summarise my query, I want to disable the cookie banner on one particular page but i can not seem to do so. I have tried adding the piece of code suggested for the functions.php but that has not worked. Please can you advise?
I’ve tried adding the filter code to my functions.php but it doesn’t make any difference…
Forum: Plugins
In reply to: [Complianz - GDPR/CCPA Cookie Consent] Cookie Banner showing twiceThanks Leon, I disabled w3 and it fixed it…trying to find the problem within W3 now, I think it is something to do with the minify settings.
Thank you for your help, much appreciated!
Forum: Plugins
In reply to: [Complianz - GDPR/CCPA Cookie Consent] Cookie Banner showing twiceHi Leon,
Thanks for your reply…yes I tried clearing the site cache but it still happened. Also tried viewing the page in private mode and also on 2 other devices.
I have added the site link…