ThemeShaper Forums » Thematic

[closed]

Targeting a new page with functions.php location cookie

(2 posts)
  • Started 3 years ago by diana
  • Latest reply from diana
  • This topic is not resolved
  1. diana
    Member

    I need to apply a bit of existing functions.php code to another page. With my level of understanding, I don't see how this code targets a particular page, so I'm having trouble targeting the new page. Here's what I have.


    function show_popup($content) {
    global $post;
    $location = get_post_meta($post->ID, 'location', TRUE);
    if (strtolower($l) == strtolower($location) || strlen($location) == 0 || (isset($_COOKIE["Location"]) && strtolower($_COOKIE["Location"]) == strtolower($location))) {
    return $content;
    } else {
    ?>
    <div id="popup">
    <p>foo.</p>

    <p>Continue?</p>
    <form action="<?php echo $PHP_SELF ?>" method="post">
    <input type="hidden" name="location" value="<?php echo $location; ?>" />
    <input type="submit" name="confirm" value="Yes" />
    <input type="submit" name="deny" value="No" />
    </form>
    </div>
    <?php
    }
    }
    add_filter('the_content', 'show_popup');

    Do I need to dig into the SQL or is there something I'm overlooking?

    Posted 3 years ago #
  2. diana
    Member

    BTW, functions.php also contains:

    if (isset($_POST['confirm']) && isset($_POST['location'])) {
    	setcookie("Location", $_POST['location'], time()+3600);  /* expire in 1 hour */
    }
    elseif (!isset($_COOKIE["Location"])) {
    	setcookie("Location", "", 1);
    }
    elseif (isset($_POST['deny'])) {
    	setcookie("Location", "", 1);
    }
    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.