1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Wordpress Plugin that checks for cookie

Discussion in 'Web Design' started by filipe3x, Jul 22, 2013.

  1. filipe3x

    filipe3x Registered Member

    Joined:
    Jan 14, 2012
    Messages:
    52
    Likes Received:
    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
     
  2. filipe3x

    filipe3x Registered Member

    Joined:
    Jan 14, 2012
    Messages:
    52
    Likes Received:
    5
    anyone?
     
  3. CodingAndStuff

    CodingAndStuff Regular Member

    Joined:
    May 6, 2012
    Messages:
    236
    Likes Received:
    84
    Occupation:
    Swagstronaut
    Location:
    You can't have my bots. Sorry :'(
    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 Thanks x 1
  4. monkid

    monkid Power Member

    Joined:
    Jan 2, 2010
    Messages:
    680
    Likes Received:
    310
    Thanks for sharing! I'll try this soon. :)
     
  5. jspx85

    jspx85 Newbie

    Joined:
    May 4, 2013
    Messages:
    17
    Likes Received:
    0
    Occupation:
    CMS PM
    Location:
    London
    Theres a WP plugin called : cookie-cat that does this.