As seen on Webfroot and this site, now in WordPress Plugin form!
Current Version: 1.3
What it does
How it works:
Users are issued cookies which are used to track last visit. If this is their first visit, all comments in the last 14 days are unread. The plugin generates a list of unread comments. It keeps track of the user’s read posts for the session, removing them from the list as the user goes. Each page load updates the last unread timestamp cookie. Users can also mark all comments as read.
- RECOMMENDED: Install WordPress Plugin Manager then use the One Click Install for Smart Unread Comments. This will also make it easier to install other plugins and upgrade them in the future.
- OR: Download Smart Unread Comments, extract and upload
wp-content/pluginsdirectory. Log-in to your WP admin panel, go to the Plugins tab and activate the Smart Unread Comments plugin.
In your template, add this code.
<ul><?php echo get_smart_unread_comments(); ?></ul>
get_smart_unread_comments() also takes options:
Maximum posts with unread comments to display.
If true, when there are no unread comments, it will output a
<li class="wbftSUC_NoComments" >item containing $no_unread_comments_text
If true, when there are more than $limit unread comments, it will output a
<li class="wbftSUC_MoreComments" >item containing $more_unread_comments_text
Default: “Mark all comments as read”
String used in link Mark all Comments as Read link.
Default: “There are no unread comments”
String used when there no unread comments and $output_when_no_unread_comments is TRUE
Default: “There are %d more unread comments…”
String used when there are more than $limit unread comments and $output_when_more_unread_comments_than_limit is TRUE
%d will be replaced with a count of how many more comments there are to view.
You’re looking at it!
CSS Classes output:
Remember, CSS classes are CASE SENSITIVE.
Used on the Mark Comments as Unread link
Used on comments less than 6 hours old
Used on More Unread Comments list item
Used on No Unread Comments list item
1.3: Now uses permalink structure, and sets cookies to your blog’s path. $limit defaults to 5 (not 10), and $output_when_more_unread_comments_than_limit defaults to TRUE.
1.21: Fixed broken (x)html validation due to stray
1.2: Fixed major bug with post title links.
1.11: Tables are now pulled from WP variables.
1.1: Initial Public Release.
Comments on Pages (as opposed to posts) turn up on the list, but visiting the Page doesn’t mark those comments as unread.
- Chris Beaven (aka SmileyChris) for writing the original code seen on Webfroot, and helping with updating it.
- Dan aka Mufasa and Tom for isolating the code from Chris’s Webfroot code magic and encouraging Me to write it.
- Brett Taylor (Me! aka Glutnix) for turning it into a WP plugin and making the number of unread comments on each post link to the oldest unread comment rather than the newest unread comment.
Bugs and Suggestions
Any bugs or suggestions, please email me â€“ email link in the sidebar (RSS readers: drop by the site ).