Highlight Post Widget Plugin

Posted in PHP on March 9th, 2010 – Tags: 6 Comments

The purpose of this plugin is simple. I want to list recents update of my posts. Similiar to default “Recent Posts Widget” by Wordpress, but this one sort the post by last modified time and enable to add a short note about change or update being made.

For example, I maintaince a wordpress plugin (we name it, “Hollydolly Plugin”) and create a post about it on my blog. And because the nature of blog—when new posts are added the older ones are taken down automatically—it’s only a matter of time that post ‘disappeared’ from frontpage and no longer seen by visitor. So, when I release a new version of “Hollydolly Plugin” and updated the old post about it, unfortunately, there is no way I can do to ‘attract’ visitor to read (again) that post.

Right, in the new version of Wordpress (since version 2.7) there is an option to make it as sticky post—make it listed on the top of frontpage. But that not my choice. I want to list it on my sidebar and displayed all over my blog. So I create this plugin for that purpose.

You can see the live example of this plugin on my sidebar. There are some menu on the sidebar; where the last one  was genereated by this plugin.



view larger image

Add or edit the custom field to be displayed as a note on the sidebar.

Requirement
I create this plugin for Wordpress version 2.9. I never test it on lower version, but I think it should work on Wordpress version 2.8 that support dynamic sidebar. Right, you also must use ‘widget ready‘ theme.
Installation
Here  (manual) installation and the download url.

Appearance (CSS)
I did not add any CSS to this plugin. By default, it will use the standard style, as same as “Recent Post” widget.

Below are the hint to change the style of this widget. Just add the code below to your style.

Template CSS:/*Template CSS*/
#sidebar li.widget_highlight_post {your_code_goes_here}
#sidebar li.widget_highlight_post span.highlight_separator {your_code_goes_here}
#sidebar li.widget_highlight_post span.highlight_note {your_code_goes_here}
Example CSS:/*Example CSS*/
#sidebar li.widget_highlight_post {}
#sidebar li.widget_highlight_post a span.highlight_separator{font-weight: bold; color: #999999 !important;}
#sidebar li.widget_highlight_post a span.highlight_note{display: block; color: #999999 !important; font-size:11px; line-height:100%;}

The configuration is easy. Just Login to WP-Admin and go to Appearance > Widgets. Drag “Higlight Post” widget to sidebar, and you can configure this plugin from there.

A. Widget Configuration

Title
The title of the sidebar (default: Highlighted Posts)
Meta Key
The name of custom field that you want to use (default: highlight)
Number
The number of post you want to show (max: 5 post)
Separator
Separator between post title and the notes (default: #raquo;)

B. Post Configuration

Just add new custom field to the post. And add some value you want to display as a notes (see: snapshoot). The name of custom field must be same as Meta Key you configured earlier.

C. Sorting & Removing

This plugin list the post base on last modified time. Just update your post and click Publish button, to make it on top. Updating custom field does not mean you update/modified the post, except you click “Publish” button.

To remove the post from the list, just delete the custom field you created above…


6 Comments

  1. [...] Original post: Highlight Post Widget Plugin for Wordpress – Lokamaya [...]

  2. SuperSonic says:

    Hola, ЎGracias por el artнculo. Cada vez que quieres leer.
    Have a nice day

  3. Zaenal says:

    Hola, gracias por visitar mi blog

  4. I am always searching into stuff about info that I do not know about, even though it might be old news. It is not an easy task to search things that you do not know about, because what do you look for? ;) Your blog was right up my alley on something new to me. Great post! Thanks.

  5. John says:

    This work on my Wordpress 2.9

    Thanks for the plugin

  6. Zaenal says:

    Hi John, your welcome. And thanks for the feedback.

Leave a Reply