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: « 2611 10 9 8 7 6 5 4 3 [2] 1 » Show All

  1. Hi Admin,

    I’ve tried that code but I just get the following in my page:

    get_var(”SELECT post_content FROM ” . $table_prefix . “posts WHERE ID=” . $the_ID); echo substr(strip_tags(trim($the_text)) , 0, $num_chars) . “…”; endwhile; ?>

    I’ve got the PHP in Pages plugin installed, but still no joy…

    Just to clarify, I don’t want this within the sidebar or anything, just at the bottom of one of my wordpress pages, not posts.

    Thanks again!

  2. dave: The best way would be to modify the SQL statement in the code so that it skips categories you do not want, or vice-versa.

    Andy: Check your email :)

  3. Hi, this plug in is awesome, but like Angelo, I would really just like to show the latest post, regardless of category, within a Wordpress page…

    Any help?

    Thanks

  4. This is *almost* exactly the plugin I needed. Thanks for putting it together. I have a blog with about 40 categories and posts get dropped into multiple categories. I’d like to specify which categories the recent post titles are pulled from and then how many posts are displayed. Ideally I want to display the 3 most recent posts from 4 parent-level categories.

  5. I also included within the code you send me, so that a part of the post is shown as well! Thanx very much again, I really appreciate your efforts on this!!

  6. Thanx very much! It works fine now!

  7. Angelo: It goes in your sidebar file – the plugin will no longer be needed.

    The code I put in here kept getting messed up. I will email it to you :)

  8. Ok! Do I have to add or replace this code in the plugin file or in my rightbar.php file?

    If I add it in de rightbar.php file I receive a parse error:

    Parse error: parse error, unexpected '=' in /home/klifixnl/frontpage.klifix.nl/HTML/wp-content/themes/Dark Site/rightbar.php on line 10
    

  9. Angelo: So you want to only display 1 post total? From a specified category? You could try this:

    (code removed – see post above)

  10. I understand. But is it realizable to just show 1 (the last one) post from 1 category?

  11. Klifix: I do not think I understand your question. This plugin displays the last post from each category. If you want it to show a preview of the post, use the ‘Show first X characters of posts’ option.

  12. Dear Alister,

    I’ve uploaded your plugin as in advice of some developers on wordpress support forum.
    What I want to do is this:

    On my website http://www.klifix.nl/ There is a right sidebar. In that sidebar there are x amount of boxes. Int he top box I’d like to appear the last post from a certain catagory (‘reviews’), with a number of caracters set to 200. I can’t seem to find to set the amount of post shown from a certain catagory to 1. Can you help me with this?

  13. Thanks a lot,

    my blog is still under construction (the beginning..) but i wont forget to tell your name.

  14. Bab: No problem. Change this:

    $the_output .= '</b>: <a href="' . get_permalink($posts- rel="nofollow">ID) . '">' . $posts->post_title . '</a>';
    
    if ($ddle_show_date) {
    	$the_output .= ' - ' . date($ddle_date_format, strtotime($posts->post_date)); 
    }

    To this:

    $the_output .= '</b>: ';
    
    if ($ddle_show_date) {
    	$the_output .= date($ddle_date_format, strtotime($posts->post_date)) . ' - '; 
    }
    
    $the_output .= '<a href="' . get_permalink($posts- rel="nofollow">ID) . '">' . $posts->post_title . '</a>';

  15. Hi,
    First, nice work ! It will be helpfull !

    But I wanted to know if it was possible to invert te date and the post title.
    That is to say : instead of having : Post title: – 07.12.06
    I would like to have 07.12.06 Post title

    Is it possible ?

    Thanks !

Pages: « 2611 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.