WordPress Plugin/Widget for Must Read Posts

Today, I was looking for a simple WordPress widget that allows me to statically display links to certain posts in the sidebar. I could have used the links widget but it wasn’t flexible enough for me. My idea was to use a certain custom field of a post or page as a trigger to display it in a widget. I searched for almost an hour but I just couldn’t find any simple, widget-capable WordPress plugins that could do this?! 

In the end, I ended up writing my own widget-capable plugin. I decided to publish it so anyone else can use it on her/his blog too. The plugin’s name is “Must Read Posts”. It shows your most recommended posts and pages in a sidebar widget or in a page. As the widget’s title is editable in the WordPress Dashboard you could change it to something like “Recommended Posts”, “Important information”, “Tips & Tricks” or whatever you like.

The plugin works using a certain custom field name called must-read. If the field exists in a page or post and has the value true, the post automatically will be shown in the widget. The next image shows the plugin in action. The Must Read Posts widget is visible in the right sidebar on this theme.

must-read-posts-in-action

Once installed, you can use it with the

<?php get_mustread('Custom Title', number of posts); ?>

 
instruction in your templates or just add it as a widget to your sidebar. If you use the widget you can also specify the maximum number of posts to be shown in the widget.

must-read-widget-config

If you use the plugin for the first time, click “Add new custom field” to add a field name must-read and insert true in the value field of the page or post you want to be shown in the new widget. Once you want to display an additional post in the widget, just select it from the custom field drop-down box and insert true in the value field.

must-read-custom-field

Installation

  1. Upload must-read-posts.php to the /wp-content/plugins/ directory.
  2. Activate “Must Read Posts” through the ‘Plugins’ menu in WordPress.
  3. What to do now depends on how up to date your theme is:

Modern theme with widget support

The plugin is also a widget. If your theme supports widgets, and you have installed the widget plugin, adding the plugin to the sidebar is easy: Go to the appearance menu and drag and drop the widget into the sidebar. Don’t forget to save your new widget structure using the save button below.

Old school theme without widget support

This will require some programming in the sidebar.php file. There are many resources on the web about how to do this.

Further Customization

The look of the list of posts and pages in the widget can be customized using the style.css cascading style sheet. Just add your own or the following style to your current theme’s style.css file:

#mustread-posts li {
   list-style-type:square;
   margin-bottom:0.4em;
}

 
The plugin is available from the WordPress plugin web site: Must Read Posts Widget.


You may also be interested to read:

43 Responses to “WordPress Plugin/Widget for Must Read Posts”

  • Marcus says:

    Indeed a very simple but effective way to show important posts in a widget. Thanks for the great work! You may want to consider sharing your widget on the WP plugin website http://wordpress.org/extend/plugins/tags/plugin

  • Jan says:

    Marcus, as of today, the plugin/widget is available from the WordPress plugin site:
    http://wordpress.org/extend/pl.....read-posts

  • Matteo says:

    Ho, I appreciate your work, but i would like to use with conditional tags in sidebar, so that visitors can see “must read posts” only when they visit a category, or archive. I paste your code in a php sidebar widget but I have an error “Call to undefined function get_must_read()”

    What’s wrong?

  • Matteo says:

    I think that Must Read Posts Plugin is incompatible with K2 sidebar module and K2 widgets.

  • Jan says:

    Matteo, you may want to try get_mustread() instead of get_must_read(), there’s an error in my documentation. The plugin/widget should be compatible to every “proper” WordPress 2.7 theme as I’m using standard WP 2.7 API calls. It may not work in pre 2.7 environments though as I’m using functions not available in versions earlier than 2.3 or 2.2.

  • Matteo says:

    Thanks for your answer, I’m trying your plugin in WP 2.5. I made the modifcation you suggest and I notify you if it works. Thank you

  • Matteo says:

    No luck, I’ve tried your plugin with WP 2.5 and K2 theme and is not possibile to view the sidebar widget in K2 sidebar management. Putting the code you give in a PHP widget cause an error.

  • Jan says:

    Matteo, the latest version (1.0.5) runs well with Exec-PHP and PHP templates in WP 2.7, I’ve just tested it. If it still doesn’t work in WP 2.5 and K2 then I don’t know why as I’m not running this environment.

  • Matteo says:

    Jan the last version of your plugin works in WordPress 2.5 with K2 sidebar manager. Thank you very much ;)

  • Jan says:

    Yay, cool!

  • kathy says:

    I cannot get changes in the “Custom field name key” box of the widget properties to stick.
    I change ‘must-read’ to my ’2008_ts’ filed name. Hit done. it is still changed if I then click edit again, but once I ‘save changes’ to the sidebar, it is reverted back to ‘must-read’ – using WP2.7, sidebar template is widgetized.

    My custom filed name change works via hard coded template calls and in posts (via exec-php) – just not within the widget …

  • Jan says:

    Kathy, I just tagged v1.0.6 that fixes this bug and uploaded it to the plugin repository. It should be available shortly. Please let me know if this fixes the problem for you.

  • kathy says:

    THANK YOU – I will let you know if it there are any probs with the update! thanks again!

  • [...] Must Read Posts allows you to put a list of posts on your sidebar that you think your readers will like. You can set the number of posts that will be in the sidebar, and the author includes a class for styling the list. Aside from putting the widget in your sidebar, the only other thing you need to do is add a custom field in your post. Posts with the field can show up in the list, making it easy to control what will be there. It does not do much, but what it does do, works well. [...]

  • katherine marie says:

    Love this thanks a million!!!!!!!

  • Hi, love what this does so far…is there a way to discover the order in which the posts are listed, and a way to change that order?

    Thanks,

    Bill Campbell

  • Jan says:

    Bill, at the moment the posts are unsorted. This means they appear as they are provided by the database. I understand that this is not an ideal way of handling the sort order. I’m planning to add some sort of sorting mechanism but I can’t say when it will be ready.

    Cheers,
    Jan

  • [...] WP Plugin Must Read Post [trick77] erlaubt Dir ausgewählte Artikel oder statische Seiten als ganz besonders in der [...]

  • Lee Seats says:

    Thanks for the great widget plug-in. I’d too like to vote for a way to modify the order. It might be easiest to do it by accepting a numeric value for the must-read field and listing the posts based on those numbers. As a user I would enter say 10,20,30, and 40 as my initial order and then I could have the flexibility to put new posts between those without re-entering all the numbers.

  • Jan says:

    Sorting is on it’s way, I just need some time to upload it to the plugin repository.

  • dains says:

    Hi, I’m looking for an expanded version of this. I’d like to put the posts from a category onto pages instead of having to mark every post. I’d be using a customized page template so code wouldn’t be an issue.

    Have you any thoughts on how your plugin might be extended to do this?

  • Jan says:

    Dains, I’m pretty sure you will find such a plug-in on WordPress’ plugin site.

  • DrFaulken says:

    This plugin was just what I needed. Thank you very much!

  • Jeff Harding says:

    Is there a finite limit on the number of posts? I changed it from 10 to 20 and it crashed my site. Worked great until then. I use it as a widget.
    Thanks.

  • Jan says:

    Jeff, I just set it to 20 and and there’s absolutely nothing odd happening. You may have entered a space or character in the box accidentally. I can’t see that something like this could happen by entering just a different value.

  • Leave a Reply

    Spam protection by WP Captcha-Free