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.8   Updated Thursday, August 14th, 2008 at 8:20pm

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

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

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

Pages: « 1513 12 11 10 9 [8] 7 6 5 4 31 » Show All

  1. Hey, I use your script at my site: http://www.makenosense.net. But when I post a new post and assign it to a category the listing of latest post from each category won’t change.

    I found out that I need to post the “<!-- ddlastfromeach -->” inside the post, then save. And then edit it again and delete “<!-- ddlastfromeach -->” for the listing of latest posts to change.

  2. Hey, I use your script at my site: http://www.makenosense.net. But when I post a new post and assign it to a category the listing of latest post from each category won’t change.

    I found out that I need to post the “” inside the post, then save. And then edit it again and delete “” for the listing of latest posts to change.

  3. I am having the same problem as below. How can this be fixed so I can see the latest post.
    “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

  4. Perhaps I will set up a section in the forum where people can post their modifications to scripts.

  5. Mike,

    Category selection into the admin page was already done by Jesse. I have it and I’m using it on my site, too. Email me at gmail if you want it. Username is johnheart.

  6. ADMIN: Your solution worked like a charm . . . great script.
    As a future feature, you may want to work the category selection into the admin page . . . I don’t think there are any other plugins out there to do that.

    JH: Thanks for the comments… I have it resolved with the code modification in the plugin.

  7. Mike Wilson,

    Try this code without using the plugin:

    http://latestpost.pastebin.co.uk/3890

    Note: Pls disregard previous 2 posts. I can’t display proper code here.

  8. Mike: Find this line in the script:

    AND {$table_prefix}categories.cat_ID = {$table_prefix}post2cat.category_id

    And after it, add this line:

    AND {$table_prefix}categories.cat_ID = 4

  9. Hello . . .
    I think this has been answered once, but the code has been removed. I am using this plugin, and love it! But I want the code to pull from only one category. I am using to display the newest post (excerpt) in my sidebar from the Journal Category (ID=4).

    I really need this to work…
    Thanks

  10. goxu: That will not work at all like that. You have referenced the $post variable outside of its scope, and strstr just uses basic strings, not arrays of strings anyway. I may see about adding this feature next time I update though :)

  11. Hi,

    I’m trying to eliminate entries of the same subjects, which happens when a post has multiple categories assigned.

    I added the following code under the line 283

    if (($ddle_limit == 0) || ($limit_check post_title ." ";   // I added this
          if(!strstr($post_titles, $posts-&gt;post_title)) { 

    And under the line 343.

    $the_output .= ''; // the line 343
    
          } // I added

    I expected that the strstr() finds the same titles and skips the output. But it seems not working.

    Do you know what’s wrong with this? Or any other ways to accomplish it?

  12. 109
    Jon

    This is a cool plug-in

  13. [...] Latest Post from each Category Crea una lista con l’ultimo post pubblicato in ogni singola categoria. Può essere inserito nel template oppure in un post o in una pagina statica. [...]

  14. JH: Ah yes, I forgot to make that fix. I just updated the file :)

  15. drag&drop,

    As Jesse have said…

    “…Also I do believe the elipse (…) has been added, but I there was an error in the code. On or about line 338, you will need to replace sizeof with strlen.”

Pages: « 1513 12 11 10 9 [8] 7 6 5 4 31 » 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.