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.

Download

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

Installing

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

Using

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.

Demo

Here you can see the plugin in action:

Latest Post From Each Category

Options

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: « 2012 11 10 9 8 [7] 6 5 4 3 21 » Show All

  1. 105
    drag&drop

    This plugin works great, Admin… i’ve got just a small problem using “Show first X characters of posts”.
    When it reach the max characters allowed, it doesn’t show “…” or anything else… just a “brutal cut”
    It’s normal?

  2. 104
    Shane

    Well, you might want to consider it for a future release. IMO it is a little tacky cutting off in the middle of a word which is what happens in most cases if you cut off at a max character. I am going to try and play with your script to tweak it to my needs … it definitely is a good start at fixing the problem of wanting to display the latest post from each category on a homepage. Thanks!

  3. Shane: At this time it simply cuts off where it cuts off. It could of course be added – anything is possible :)

    As far as the styling and html in the posts, yes, it is stripped out. The main reason I did this was so that it the excerpt would not end before a tag was closed. If your post starts with a bold tag, and it is not closed before the excerpt ends, the rest of the page would be in bold, etc.. :)

  4. 102
    Shane

    I also just noticed that the text from the blog does not contain any of the styling/HTML. For example if there is a word in bold or maybe even a photo in the first paragraph of the blog – all that is stripped out. I am sure this is intentional, but is there a way to allow the styling/HTML?

  5. 101
    Shane

    Wow – I think this is going to do what I need it to do. Thank you! One questions … the “Number of characters to show” will actually cut off exactly at the character limit, even if it is in the middle of a word or sentence. How can I change this to end at the nearest paragraph end from the cut off point? Post Teaser plug-in offers a similar option: http://dev.wp-plugins.org/wiki/PostTeaser – I am going to explore and see if this can be added. Thanks.

  6. i know, but the option switch modifies only the list rank (sort). the list still shows the oldest posts for each category. strange

  7. enrico: By default, it should show the latest ones – but this can be changed with the sort order option on the options page.

  8. hi

    but the plugin shows the last posts or the oldest ones?

    in our blog it shows the old ones. (???)

    is it correct?
    thnx
    http://www.markettari.biz

  9. Jesse,

    Excellent. The “!=” did the trick. Thanks a lot.

  10. Gemme:

    To remove a specific category use this line, and sorry for the confussion

    AND {$table_prefix}categories.cat_ID 3

    “” means not equal, you can also use “!=”, this means the same thing. I think “!=” is the “correct way” but I have “” in my code and I know it works.

  11. No, I don’t think it was your fault as you actually correctly mentioned that using the “=” shows up one selected category.

    The thing I ran into is that if I want to exclude certain categories.

    You’re example was:

    AND {$table_prefix}categories.cat_ID 3
    (Where 3 is the category ID)
    The new line removes that category from the list

    This is were I got the database error.

    Sorry for the confusion. You’re doing great work.

  12. Gemme:

    Oops, Sorry! Looks like that was an error on my part it should be as you stated.

  13. Jess:

    I have tried your suggestion to limit categories showing up.

    When I add.

    AND {$table_prefix}categories.cat_ID 3

    I get a database error

    When I only want to show 1 category using

    AND {$table_prefix}categories.cat_ID=3

    it works.

    Is this an issue on my side or …

    Thanks

  14. hi there.
    is it any way that :

    a)your plugin could also show the excerpt ? ( i tried add_option('ddle_excerpts', TRUE);, but nothing happens.

    WE: while writing , i managed to get the excerpt

    $the_output .= '</b>: <a>ID) . '"&gt;' . $posts-&gt;post_title . '</a>'.my_excerpt_function($posts-&gt;ID) ;
    
    , but still,it would be nice to be enabled from the control panel

    b)i want to have 3 boxes on the same page, each one with the latest x posts from a category that i select.
    the problem is that i don’t want to install the plugin x times , i tried cloning the function with different names, but it turned out to be a bad ideea :)

  15. actually.. instead.. am i able to possibly call the funtion in my sidebar and have a categories remove in the function call??

    thanks to both Jesse and Aliester for the help and plugin!!!

Pages: « 2012 11 10 9 8 [7] 6 5 4 3 21 » 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.