WordPress.org

Support

Support » Plugins and Hacks » recent-post Plugin

recent-post Plugin

  • 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:


    Title: Content

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is it possible to modify this plugin so that it would get the exerpt from the most recent post in a category? Or is there another way to do that…

    Dylan,

    I think that is a great suggestion. I’ve modified the plugin to support excerpts. Please check out the syntax and download the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘recent-post Plugin’ is closed to new replies.
Skip to toolbar