I’ve been looking for a plugin in WP that would allow me to display a post in the sidebar. More specifically, the most recent post of a particular category. I wanted to put the most recent post in the News category in my sidebar. So, I wrote a plugin. Save the recent-post plugin to your wordpress/wp-content/plugins directory, then change the .phps extension to .php.
After activating your plugin, you can place the get_recent_post() function anywhere in your php templates. I placed it in my sidebar.php template, as:
< ?php _e(get_recent_post(2)); ?>
“2” in this case is my News category which has a Category ID of 2. The output of the get_recent_post() function will look like the following:
- The topic ‘recent-post Plugin’ is closed to new replies.