Have you seen popular websites highlighting new comments since last visit? It is a great way to increase discussion on your site and provide users with more reasons to come back. In this article, we will show you how to highlight new comments for returning visitors on your WordPress site.
Subscribe to WPBeginner
If you don’t like the video or need more instructions, then continue reading.
First thing you need to do is install and activate Comments Since Last Visit plugin. The plugin is hosted on GitHub and here is how to install WordPress plugins from GitHub.
This plugin works out of the box upon activation, and there are no settings for you to configure. It will now highlight new comments since last visit with a blue background color.
How It Works?
The plugin sets a cookie in user’s browser when they visit any page on your website. On their next visit, it matches cookie with the comment dates and adds a CSS class new-comment to comments posted after the cookie date.
You can override the default CSS in your theme’s stylesheet. For example, you can use this CSS code as a starting point.
content: New ;
/* min-width: 500px; */
border: 1px solid #C2C2C2;
If comments are important for your website, and you get a lot of comments, then you would probably want to display newer comments first. This will ensure that returning visitors get to see new comments without scrolling down too much. See our guide on how to rearrange comments in WordPress.
That’s all, we hope this article helped you highlight new comments since last visit in WordPress. You may also want to check out our tutorial on how to highlight new posts for returning visitors in WordPress. Feel free to play with the CSS to meet your needs.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Google+.