WordPress.org

Forums

recent-post Plugin (3 posts)

  1. gsoli
    Member
    Posted 10 years ago #

    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

  2. dylan
    Member
    Posted 10 years ago #

    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...

  3. gsoli
    Member
    Posted 10 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.