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: « 2015 14 13 12 11 [10] 9 8 7 6 51 » Show All

  1. I added new post in several categories, but the output for the plugin remained the same. What do I need to do?

  2. Hi,

    I appreciate and I utilize your plugin on my site. I have just 2 comments:

    * around line 64 of the last version (1.5)

    replace
    Latest Posts From Each Category v1.4

    with
    <h2>Latest Posts From Each Category v1.5</h2>

    * it will be nice for non-english speaking people to change around line 302 the date function with the date_i18n()function to display a localized date format accordingly with the $WPLANG variable

    replace
    $the_output .= ' - ' . date($ddle_date_format, strtotime($posts->post_date));

    with
    $the_output .= ' - ' . date_i18n($ddle_date_format, strtotime($posts->post_date));

    regards
    marc

  3. asuan: Thanks, I will add a link to it.

  4. With your permission i traslated your plugin to spanish. Thanks for all.
    The link: http://www.asuan-peluqueros.com/dd-lastest-from-each-SP.txt

  5. Damon: It is – just search the WordPress docs to find out how to get the ID of the page being viewed. Then you can just have a simple if statement that checks it.

  6. 145
    Damon

    Oops, the code won’t show properly. Ok, I used the info I found on this link:

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

    Now I want to add a conditional statement that will run the code only if on a specific page. Is that relatively easy to do?

  7. 144
    Damon

    Ok I think I found the answer to my own problem, however now I have a new question. Here’s the code I found and modified:

    Events

    > –

    (Note: The ‘a’ href is shown that way because the code breaks when I post it here)

    That’s great except that info shows up on every page in the
    sidebar. I’d like to add a conditional statement that runs the code above in the sidebar only if on a specified page, i.e.

    then,

    the above code would work…

    is that possible?

  8. 143
    Damon

    Gahhhh! This is the plug-in I’ve been looking far and wide for! I only need one modification.

    I want to display 3 posts total. From a specified category.

    Is it possible?

  9. Kons: No. You are looking for an RSS aggregator plugin.

  10. i would like to use this plugin on a different way. i want to show latest posts from another blog, is is possible with your plugin?

  11. I commented out the part of your plugin that introduced a linebreak after the separating dash, still curious if you might ever include options for formatting the output…

  12. 139
    ovizii

    how would I change the plugin so that it does not insert a breakline after a separating “-” ? have a look here in the right sidebar: http://www.klub-kamikaze.com/ after every title there is a “-” and then a newline and very often the dash is on a line by itself… I woudl like to take out the linebreak after the dash, can I simply edit the plugin? do you have any plans for letting users edit the layout in the options page rather than editing the plugin?

  13. mookie: That code should work – what was the error?

  14. i was curious about hiding child categories. i searched the comments and found this by Jess:

    You can hide child categories by:

    -In the script, find this line (on or about line 233):
    AND post_status = ‘publish’
    -Right ABOVE it, add this line:
    AND {$table_prefix}categories.category_parent = 0

    but that returns a db error. any sugg?

  15. hi, i would like to display not just recent post on each category, but a number of recent posts in each category, how to do that?

Pages: « 2015 14 13 12 11 [10] 9 8 7 6 51 » 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.