Using cookies in query
-
Goal is to display a list of recent posts visited. (including thumbnails) I’ve set a cookie saving the post id’s of recent posts and if i echo $_COOKIE[‘pages_visited’]; i get a successful result of ’60, 54, 33, etc’.
My question id how do I get this to work in a query, the code i have is:
<?php $post_list = $_COOKIE['pages_visited']; ?> <?php query_posts('post_id=array('.$post_list.')&showposts=4&post_type=post_therapists'); ?> <?php while ( have_posts() ) : the_post(); ?> <p><?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <?php the_title(); ?> </a></p> <?php endwhile; ?>
Any ideas anyone?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Using cookies in query’ is closed to new replies.