Wordpress Plugin that checks for cookie

filipe3x

Registered Member
Joined
Jan 14, 2012
Messages
52
Reaction score
5
I need a wordpress plugin that checks for a cookie before showing a page/post.

For example, if cookie X is present show page A. If cookie is not present, show page B.

Is there any plugin that can do that kind of logic?

thanks
 
It's just a simple cookie check - you don't need a plugin either. Just hard-code it into your theme.

Code:
<?php
if(isset($_COOKIE['cookie_name_here'])){
    //Cookie is set
    require_once("page_a.php");
}else{
    //Cookie wasn't set
    require_once("page_b.php");
}
?>
 
It's just a simple cookie check - you don't need a plugin either. Just hard-code it into your theme.

Code:
<?php
if(isset($_COOKIE['cookie_name_here'])){
    //Cookie is set
    require_once("page_a.php");
}else{
    //Cookie wasn't set
    require_once("page_b.php");
}
?>

Thanks for sharing! I'll try this soon. :)
 
Back
Top