Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.92   Updated Tuesday, July 7th, 2009 at 6:18pm

Latest Post from each Category plugin for WordPress

This plugin displays a list of the latest post from each category of your WordPress installation. It can be added to a post or page, or used directly in a template file. In the plugin’s options page you can choose the sort order, show or hide the dates, select the date formatting, show the first X characters of the content, display a link to the comments, and show comment counts, as well as other options.


  If you have found this page useful, please consider donating. Thanks!


  • Download the above file, rename it from .txt to .php, and upload it to your plugins directory.
  • Enable the plugin.
  • Configure the plugin options (under DDLatestFromEach).


There are two ways you can use this plugin.

1) In a post or page, insert the following line:

<!-- ddlastfromeach -->

2) In a template file, insert the following code:

<?php echo dd_last_from_each(); ?>

Change Log

  • 07-07-09 Version 1.92 – Slight change to the way the list is displayed.
  • 07-06-09 Version 1.91 – You can now choose how many posts per category to display.
  • 02-19-09 Version 1.9 – Added option to use only selected categories.
  • 08-14-08 Version 1.8 – Tested with WordPress 2.6. Now uses WordPress function for determining date/time to show up to date posts. Added option to exclude categories.
  • 09-27-07 Version 1.7 – Updated to support WordPress 2.3. Added ‘Load Default Options’ button.
  • 05-31-07 Version 1.6 – Better support for international date formatting
  • 05-16-07 Version 1.5 – Updated for WordPress 2.2
  • 02-20-07 Version 1.4 – Updated for WordPress 2.1 (new pages were showing up in the default category)
  • 08-09-06 Version 1.3 – Added options to show comment links and counts. Also added an optional limit to the number of links shown, and a few other fixes.
  • 06-03-06 Version 1.2 – Added an option to turn category names into links. A bug was also fixed where extra slashes were being shown in the header text.
  • 05-31-06 Version 1.1 – You can now choose the sort order of the output, hide password-protected posts, and show the first X characters of the content after each post. A few other fixes have been made as well.
  • 05-30-06 Version 1.0 – First release.


Here you can see the plugin in action:

Latest Post From Each Category


Here are the options available in this plugin’s options page in the WordPress admin panel.

Header text

This is shown above the list of posts.

Sort order

You can choose to have the data sorted by category or date. You also have the option of ascending or descending on both.

Show link to comments

When enabled, this will add a link to the comments for each post listed.

Include number of comments

This option only applies if Show link to comments is enabled. It adds the number of comments to the comment link.

Include link for posts with no comments

This option only applies if Show link to comments is enabled. It allows you to include or hide the comment link for posts with no comments.

Turn category names into links

Enabling this option will turn category names into links to the categories.

Hide password-protected posts

This prevents password-protected posts from showing up.

Show date after listed posts

This will show the post date after each post in the list.

Date format

If you are showing the date after posts, this will allow you to configure the date format (using the standard PHP date() format)

Show first X characters of posts

This allows you to show a preview of the content under each post in the list.

Number of characters to show

This lets you specify how many characters of the content will be shown, assuming you have the previous option enabled.

Limit list to X categories

This allows you to set a limit on the number of categories that will be shown in the list. Set to 0 for no limit.

Excluded category IDs

This is a comma-separated list of category ID’s you want excluded from the list.

Included category IDs

This is a comma-separated list of category ID’s you want to use in the list. This option only applies if you are not using the excluded category IDs option.

Max posts per category

If you would like to show more than one post per category, you can change the number here. To display all posts, use 0.

Pages: « 3811 10 9 8 7 6 [5] 4 3 2 1 » Show All

  1. ron: It is possible, but some of the code would have to be re-written, as it was not made for this. If you are interested in having a custom version made, contact me :)

  2. is tere a way to display more than one post from each category?

  3. enrico:

    Not to take away from Admin, but if you are looking for a plugin to display only one category and a number of recent posts from it. Then try my “N Posts from Category X” Plugin. You can find it at Storm’s Corner on the Plugins Page. Good Luck…

  4. 72

    excellent. but i’d like to know how we could put an ADDON on “sort category”. i mean i’d like to assign the ID-number of category i want to display.

    if i set to limit to 1 category the listing, i want to decide wich category as well (by ID#, not by date or alphabetic).

    it will be great.

  5. Sean: I am not using any special CSS just for this plugin – it just uses my site’s standard CSS for lists.

  6. What did you use for your stylesheet code to get it to look like that? I look at your stylesheet and could not find anything distinctive. Thanks!

  7. realthor: There are several plugins out there that will simply give you a list of the posts in a category (if you manually give them the cat id). This plugin is more aimed towards automatically displaying the other posts from the category the current post is in.

  8. hi, i didn’t yet tried your plug-in but it seems useful for what i want to do namely get the latest post from all the subcategories in one category (example: category -> Work In Progress, subcategories -> illustrations, phots, 3Dimaginery, etc). Ususlly the latest post in each subcategory would present the latest update to that one so these would be the news to present on a Work In Progress page.

    Could you add this functionality in your plugin to be able to show the latest post from each subcategory of a certain category, eventually providing to the plug-in the ID of the respective category?

  9. Admin

    No Problem. I thought I might be stepping on your toes, but I really like this plugin and I thought I would help. I hope you get a chance to look at the alterations I made to the code. Im finding a problem with my modified “…” thingy it interupts tags and what not. But we can talk about that off the list.

  10. Jesse: Thanks for helping! It makes my daily task of going through comments on this site much easier when someone elses shares their input :)

  11. 65

    Thanks again Jesse.

    Changed the code and that sorted that little issue. I have sent you an email so you can have a look at the other minor problem.

    I can see this becoming one of those ‘must have’ plugins for any new site :)

  12. JamesICT

    There should not be any delay in the displaying of a new post. Can you display a link of where this is happening. I would like to take a look at the post that are showing up vs. the new post that is not. You can email me off the list and I will work on this with you. My Email is below.

    And on the elipse the is a minor problem with the code. If you are not timid to modify the plugin you can, do a search for sizeof and replace it with strlen. Then your … should appear with no problem. If you are worried about messing something up email me direct at stoi2m1 at yahoo dot com.

  13. 63


    Thanks for the advice. I did actually try that earlier too but it only outputs the last 5 alphabetically. So then I tried using the ‘by date descending’ which is almost what I need.

    I then tried a test post to see if that would display and it is not yet. The latest date is showing as yesterday. Is there a way of making it display the most current or is there some kind of time delay set?

    And one other minor thing [no, I am not usually this picky] but if you set the character limit to x amount, it is always going to happen that words are cut off midstream. Is it possible to add an elipses at the end so that instead of seeing

    The man wen

    it would become

    The man wen…

    Thanks again for your help :)

  14. JamesICT

    This feature was added to the plugin recently. If you dont have the most recent release you can download it from above. If you do have the latest release then go to the options page of your Wordpress Dashboard and click on the tab named DDLatestFromEach. Then down at the bottom there is a choice to set the number of recent posts to display change ot from a 0 to a 5.

  15. 61

    This looks like an excellent plugin Admin. Thanks for sharing. The only trouble I have is that it seems to do everything but the one thing I am after, namely, adding ONLY the 5 latest posts IN TOTAL from ANY AND ALL categories – with a character limit.

    I don’t suppose there is any way I can get that result is there?

Pages: « 3811 10 9 8 7 6 [5] 4 3 2 1 » Show All

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.

Be sure to wrap all code in <code></code> tags.