I did the following…
https://github.com/alexstandiford/easy-age-verifier#custom-logic-filter
//The function that adds the check. Be sure to pass the $checks variable
function home_page_disable_verifier($checks){
//Check if the current page is the home page
if(is_home()){
//If it is, add the check ID key, and set it to true.
$checks[“is_home_page”] = true; // is_home_page can be whatever you want it to be. Make sure it’s unique!
}
else{
//If not, add the check ID key, and set it to false.
$checks[“is_home_page”] = false;
}
//Returns the array with the newly added boolean
return $checks;
}
add_filter(‘eav_custom_modal_logic’,’home_page_disable_verifier’);
But now what do I do if I want to disable the Age Verifyer on all pages that are not the home page?
I know it would be something like this but this is to display a warning on those pages and I want it to be disabled completely…
//The function that adds the content if you’re on the home page.
function load_home_page_warning(){
echo “Warning! Content on this site is not suitable for visitors under the age of 18.”;
}
//Ties the action to when the home page returns false.
add_action(‘is_home_page_custom_is_false’,’load_home_page_warning’);
By the way I tried that code and it didn’t seem to add any warning to the home page like it was supposed to. I don’t need to know how to do that I just wanted to test and see if it worked and it didn’t.
So how would I edit that code to disable it on all pages except for the home page?
Thanks,
-
This reply was modified 7 years, 9 months ago by
marketing2.
-
This reply was modified 7 years, 9 months ago by
marketing2.