Show on view of second page after cookie is set.
-
Hello,
I’m using this to call the plugin in my template:
<div id="recentlyviewed" class="clearfix"> <?php if (function_exists('zg_recently_viewed')): if (isset($_COOKIE["WP-LastViewedPosts"])) { ?> <hr> <h3>Recently Viewed:</h3> <?php zg_recently_viewed(); ?> <?php } endif; ?> </div>
The problem is, once the cookie is set, it will show the conditional html above after the next page is viewed but there is nothing to show yet as the only last viewed post is the current page.
Once a user goes to the next page (the second page after the cookie is set), then there is a post to show.
I’ve tried to run a conditional check to see if there is a value in the second item in the cookie array but not having any luck.
In plain english:
Once the cookie is set, only show content if there is a value in the second item in the cookie.
Does that make sense? How can I do this?
Thanks.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show on view of second page after cookie is set.’ is closed to new replies.