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

  1. dhkeller: Just uploaded v1.41 which fixes this :)

  2. This is a fun plugin, which I really appreciate, but the styling you mention is not showing up in the version I have. I am running v1.4 of the plugin with WP 2.2, but the output does not seem to include “ddop” or an extra “div” anywhere ….

    Am I missing something?

  3. This is working wonderfully for new posts! It will make our site much more usable. But not for existing posts – so far, anyway, even if we open, edit, and repost. We’ll keep playing with it. (Running 2.1.2 – as per host – which changes WP versions slowly)

    So maybe will be able to solve problem on this end – but thought it worth adding to feedback.

    Thanks!

  4. Philipp: It should not be displaying anything if there are no other posts. I uploaded another change – try it out :)

  5. It works great now! Thanks!!! One suggestion: Maybe if there are no other posts in a certain category (new category) there shouldn’t be any mention of that category below the post as it will simply show up empty.

    Other than that it’s perfect. :-)

  6. Philipp: I just uploaded a small change – let me know if it helps.

  7. The plugin sounds great, and it works, however, I also get this nasty error message in the beginning of evry post:

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/ja2/02/722/00000013/htdocs/tlab/wp-content/plugins/dd-posts-from-cat.php on line 199

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/ja2/02/722/00000013/htdocs/tlab/wp-content/plugins/dd-posts-from-cat.php on line 199

    So I had to disable it. Any advise?

  8. Subir: There is some code in the comments below.

  9. Right now the results will show at teh bottom of the post itself. But I would like to show the results in a sidebar. is there any way to do that?

  10. nathan: I just uploaded a small modification. Let me know if it takes care of the issue.

  11. 95
    nathan

    Further UPDATE: It’s only showing the Pages as part of the default category. The other categories work fine.

  12. 94
    nathan

    UPDATE: I tried limiting it to one post and then it sometimes posts one of the Pages instead of another post in that category. Interestingly, if there really are no other posts in the category, it shows nothing. I don’t understand why it seems to be adding a category to the Pages and displaying them.

  13. 93
    nathan

    Hi, this plugin is exactly what I need to create an easy internal “related links” at the end of each post. However, it is currently listing the posts in that category first (correct) and then Pages for the remaining links. How can I edit to only list posts?

  14. Adil: I may add an exclusion feature in the future. For now though, here is one way you can do it.

    Replace this line in the script:

    return $content . ddop_show_posts();

    With this:

    $c_post = $post->ID;
    $c_cat = get_the_category(); 
    $c_cat = $c_cat[0];
    
    if (($c_cat == 1) || ($c_cat == 2) || ($c_cat == 3)) {
    	return $content . ddop_show_posts();
    }

    Where 1, 2, and 3 are the categories you want to allow. This could also be changed to display for all categories except the ones you specify like this:

    if (($c_cat != 1) && ($c_cat != 2) && ($c_cat != 3)) {

  15. Thank you for this plugin-I have been looking for this for some time and I like the way you’ve done it. Could you please make it possible to have more control over the categories chosen? For instance, I want to exclude some categories (I have some categories that are too general, others that divide posts according to volume/issue–I want to be able to list relevant posts according to categories that describe content only (for instance “international” “videos” “music” and not “Volume 9″. Thanks a lot–hope you have the chance to do this.

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