display recently viewed posts
add a timestamp to single post look
<?php if (get_post_type( $post->ID ) == 'post-type' ) update_post_meta( $post->ID, '_last_viewed', current_time('mysql') ); ?>
to display most recently viewed products
<?php $args = array( 'post_type' => 'post-type', 'posts_per_page' => 5, 'meta_key' => '_last_viewed', 'orderby' => 'meta_value', 'order' => 'DESC' ); query_posts( $args ); ?> <?php if( have_posts() ) : ?> <?php while( have_posts() ) : the_post(); ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query(); ?>