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.6   Updated Friday, February 20th, 2009 at 7:19pm

Other Posts from Cat plugin for WordPress

This plugin will show the last X posts from the current category at the bottom of every post, or where you manually specify in each post. Using the built-in options page, you can choose the number of posts to show, set the header text, choose to show the post dates, select the format of the date, and choose whether or not to include the current post in the list. The latest version also has an option to show recent posts from all categories the current post is in.

Download

  • Latest Release (For WordPress 2.0 through 2.8+)
  • International Version (For WordPress 2.0 through 2.2)

    One of our visitors sent in an internationalized version of this plugin, with full support for international text and date formatting! It includes English and Spanish support. This version is only supported by WordPress 2.0 through 2.2, and will not work in 2.3 or higher!

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

Instructions

  • 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 DDOtherPostsFromCat).
  • Test it out by viewing a post.

Change Log

  • 04-27-08 Version 1.6 Added an option for excluded categories. Also a few other minor fixes.
  • 09-29-07 Version 1.5 Updated for WordPress 2.3. Added ‘Load Default Options’ button.
  • 06-11-07 Version 1.41 Added wrapper class around output (.ddop)
  • 05-16-07 Version 1.4 Updated for WordPress 2.2.
  • 01-28-07 Version 1.3 Fixed an issue in which a database error would occur when the plugin is set to check all categories that the post is in, and it is in only one.
  • 08-09-06 Version 1.2 Now if showing posts from all categories the current post is in, you can also choose to split them up into multiple lists (per category).
  • 08-08-06 Version 1.1 By request, the plugin now features an option to show recent posts from all categories the current post is in. It also has a CSS class added for easy changes.
  • 04-19-06 Version 1.0 First release. This is very similar to my ‘Posts by Author’ plugin but it lists other posts from the same category, instead of other posts by the current author.

Notice

Currently this plugin checks the first category a post is assigned to when generating a list of other posts in the same category. This means that it will work best for those of you who only assign one category to posts.

Styling

This plugin now has a div wrapped around the output with the ddop class assigned to it. For example, if you wanted to decrease the size of the text in the output, add this to your CSS file:

.ddop { font-size: 90%; }

Options

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

Show at the bottom of every post

If enabled, this plugin will generate its data at the bottom of every post, before the comments section.

NOTICE: No matter what you have this set to, you can also manually call this plugin by entering the following line where you want the data to be shown in your post:

<!-- ddpostsfromcat -->

Check all categories that current post is in

With this option enabled, recent posts from all the categories (that the current post is in) will be shown. It will also show all of these categories in the heading (if you are showing one). Disabled, it will simply show other posts in the first category this post is found in.

Split categories into separate lists

This option only applies if the previous option (check all categories that current post is in) is set. It will allow you to split up the posts into multiple lists (per category) instead of all the posts being in a single list.

Number of posts to show from this category

This is the number of posts from the current category that will be shown.

Text to show before list

This is the header for the post list. If you want to use the category title in this text, use %C.

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)

Include current post in list

This sets whether or not the post being viewed should show up in the list of other posts from this category.

Show newest posts first

If checked, this will show the newest posts first in the list. If not checked, it will show the oldest posts first.

Excluded Categories

This is a comma-separated list of category names you want excluded from this plugin. It is not case sensitive.

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

  1. John: Some versions of MySQL use <> instead of != but if one works for you, more should work too.

    Also, make sure there is a space at the end of those lines in the query string, or it may not be separating them properly. Did the error message give any other information?

  2. I was trying to do something like that before but didn’t have the ‘Check all categories that current post is in’ box checked. Now it is but I’m getting a MySQL syntax error when I try to exclude more than one category (as per your example). If I have:

    
    WHERE post_id = {$c_post}
    AND cat_ID !=7
    AND {$table_prefix}categories.cat_ID = {$table_prefix}post2cat.category_id
    

    it’s OK, but as soon as I do this:
    
    WHERE post_id = {$c_post}
    AND cat_ID !=7
    AND cat_ID !=8
    AND {$table_prefix}categories.cat_ID = {$table_prefix}post2cat.category_id
    

    I get: “You have an error in your SQL syntax”

  3. John: Find this line in the script:

    // get list of cats this post is in

    Directly after it is a SQL query. After the WHERE line, add in something like this:

    AND cat_ID != 1 AND cat_ID != 2

    That should do it :)

  4. I notice this in the plugin script:

    $ddop_excluded_cats = get_option('ddop_excluded_cats');

    but it doesn’t appear to be used anywhere else. How do I go about implementing excluding certain categories?

  5. hello! great plugin! i was wondering how to turn off the default placement under posts coz i want it in the sidebar. thank you! :)

  6. 55
    museum

    Looks great but I’ve to wait to the missing too before use it really…

  7. Thanks Maira – I’ve managed to install WP in Spanish and customize your version of the plugin too!

    Admin: thanks for the “get posts” tag info – it’s just what I needed to round off my site. In fact I came here looking for something like that and found your plugin which is a way better option!

    Hey, what about the missing DIV in the plugin? Or am I the one that’s missing it? :-s

  8. maira: Thanks, I just uploaded the new copy here as well :)

    Aaron: If you just want a listing of the latest posts from a couple of categories, you do not really need a plugin. Try this: http://codex.wordpress.org/Template_Tags/get_posts

  9. Is it possible to use this plugin more than once? E.g. by changing the function names in the plugin? I need to show the latest 5 posts from two different categories on an Index page, but I am already using the plugin for a separate job (and it’s working admirably!). Thanks.

  10. 51
    maira

    Jorge: I think I forgot to put the files in their own folder. You should create a folder named ddop under your plugins directory and place dd-posts-from-cat.php and ddop-es_ES.mo inside it.

    The zip in http://cachuflos.net/wp-content/uploads/ddop.zip has been updated accordingly.

  11. Oops – I forgot: the DIV that is mentioned in the documentation doesn’t seem to be output by the code. I’ve found a workaround (including the plugin after the post, inside its own div) but I’m suppose it’s an easy fix for Admin :-)

  12. Thanks for the plugin! I’m still new to Wordpress. I installed the international version but I don’t know how to enable the Spanish translation or how to make the dates appear in Spanish. I’ve resorted to using numbers for the time being. Any pointers will be much appreciated.

  13. Maira: Thanks :) I am adding it to the site right now.

  14. 47
    maira

    I have fully internationalized your plugin, it now show the dates in the appropiate language. I’d send you the files but I couldn’t find your e-mail, so you can download them here: http://cachuflos.net/wp-content/uploads/ddop.zip

    Files: dd-posts-from-cat.php, ddop.pot, Spanish .po and .mo

  15. [...] You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your ownsite. [...]

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