WordPress Plugin: Mark as Read
For the first time ever I created my own plugin. Starting out as a hacking attempt, it quickly changed into a prototype plugin.
What it basically does is list the articles that haven’t been read yet by a logged in user. Whenever a change to the post is made or a new comment is posted, the post moves to the top of the unread list.
Mark as Read makes it easy for your users to keep track of changes on your blog. Whenever a post is published or updated the post will show up in this list. When a new comment is posted, the post will also go up in this list and will be marked as “unread”.
- Keeps track of which articles a logged in user has read.
- Posts bump on new comments
- Posts bump on published / updates
- Customizable output
- Lists per category or all categories
- Usable non-output functions
- Download the plugin
- Upload contents of the zip-archive (the folder) to the plugin directory of your WordPress installation (default: wp-content/plugins/)
- Enable the plugin through the plugin admin panel
- Paste code inside template file
To output the list all you need to do is to put the following code inside a template file of your theme:
This will output all the unread content of all categories.
The following parameters are accepted:
the_unread_posts($categoryID, $noPostsMessage, $updateText, $rowStyle);
$categoryID (Optional, default: *”all”*):
Supply this parameter if you want to show unread messages from one category only. Give the string “all” if you want to display all categories.
$noPostsMessage (Optional, default: *”
Sets the output of an empty list.
$updateText (Optional, default: array(“New comment(s) and changes”, “Changes”, “New comment(s)”)):
Sets the output of the different types. Give an array with 3 values; first one being the output when a post has new comments and is updated, second for updates only and third for new comments only.
$rowStyle (Optional, default: *”
The HTML in which each post has to be shown. Use *%link%** to insert a permalink to the post, %title% for the post title and %type% for the type of change.