How To Display Recently Viewed Posts & Pages Of Your WordPress Site ?

There are already many plugin that allows you to display most viewed, least viewed and popular posts or pages of your WordPress site but there are very few plugins that displays recently viewed posts. You can enable your WordPress installation to show recently viewed blog posts to your website visitors by using Last Viewed Posts plugin.

The plugin provides you a widget and a template tag you can use for displaying latest viewed posts (even with single view) anywhere in your website. All posts are saved in a cookie and by default the plugin displays last 10 posts viewed by your visitors. If cookies are not accepted or no single post is clicked then no output will be displayed by the plugin.

The plugin doesn’t populates you database, all posts are saved in cookie and by default default the cookie expires after 360 days and there are 10 posts entries which it displays by default but you can change these values by editing the last_viewed_posts.php file present in this plugins’s directory.

For editing these parameters visit Dashboard -> Plugins -> Editor (if using single WordPress installation)or Network Admin Dashboard -> Plugins -> Editor (in multisite WordPress installation) then select Last Viewed Posts, open last_viewed_posts.php file for editing and edit the parameters between the equals sign and the semicolon as shown below:

$zg_cookie_expire = 360; // After how many days should the cookie expire? Default is 360.
$zg_number_of_posts = 10; // How many posts should be displayed in the list? Default is 10.
$zg_recognize_pages = true; // Should pages to be recognized and listed? Default is true.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.