I am working on a project that showcases a number of products, so I’d like to add a “recently viewed product” selection that keeps track of the last 5 or so viewed products or posts.
I saw this plugin but its 2 years old and as of now doesn’t look to be supported.
Any ideas?
You can add a timestamp to your post meta each time a product is viewed, then query the five most recently viewed products.
Assuming you are using a custom post type named ‘product’, add the following inside the loop of your single-product.php template file:
To display the five most recently viewed products: