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 Sunday, April 27th, 2008 at 8:20pm

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.5)
  • 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 2.5

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

  1. 120
    nathan

    I’ve learned a little more about my situation (116). Wordpress has a bug(?) that applies the default category ID to Pages. Since you can’t even choose categories for Pages in the admin interface, this is, well, stoopid. So…I get a similar problem with any plugin that works with category ID’s.

    Matt, I’m guessing that adding something like if is_page() to change the cat ID to 0 for plugin purposes would work. With other plugins, I’ve just changed the post2cat db entries, but that’s a hassle. I thought Pages got a cat ID of ‘0′ previously…

  2. This is exactly the plugin I need for my site but like 115 and 117 it simply shows nothing at all. I manually inserted tags in posts and used the php code in the loop and still nothing.

  3. Two questions:

    Is it possible to avoid to show the “Other posts in same category” when there aren’t others?

    Is there a possibility to modify the SQL query to show random posts from the same categories?

    Many thanks in advance.

  4. Just tried the plugin but same as Christian 115 nothing happens, I tried with php code 113, still nothing, any idea (I’m on wordpress 2.2.1)

  5. 116
    nathan

    I’ve finally had the time to get back to looking at this (see comment 95). I downloaded the current file above and it’s still showing Pages as related posts to the default post category. Any help would be appreciated.

    Right now I just have the default category named “Don’t Use” for the benefit of the content writers, but one of these days they’ll mess up. :)

  6. 115
    Christian

    After installing and activating the plugin it seems to work, but I onl get the empty ddop div tag. Anyone ideas how to fix this and/or what the reason could be?

  7. Hi, I’m using the plugin and it works well.

    Anyway I would like to avoid to show the text “Other posts in same category” when there aren’t others; do you know how I can manage to do that?

  8. Dermod: Comments are displayed inside the loop, so yes, that is possible. You will just have to disable the option to automatically show the output on all posts, and instead, add this code to single.php, right after the call to the comments function:

    <?php echo ddop_show_posts(); ?>

  9. 112
    Dermod

    Great plugin, I love it, thanks. I see that it has to be run in the Loop - but is there a way of positioning it so that it displays after the comments?

    Thanks again

    Dermod

  10. Ronson: Unfortunately I do not have much experience working with other character sets, so I am not sure really.

  11. 110
    Ronson

    Hi, I installed your plugin on a test-run blog and I found a problem. My blog is in cyrillic. Every category, title and page name is in cyrillic and the problem is that the plugin shows my page title instead the post titles. It’s funny as it is supposed to show only posts from the same category. I don’t know from where it gets my pages :) Could you please confirm whether your plugin handles cyrillic posts.

  12. Fixed the problem the page called a plugin but just need a return on the page to work. Thanks and keep up the good work.

    Alex

  13. Hi
    I think your plug-in is really good however on a page I am getting this following error any ideas? Is there any way to exclude certain pages. I have tried the option of enabling the plug-in when you add the text string but this does not work. And the error is still the same
    The page is http://www.homelifeweekly.com/?page_id=5?total=9.98

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND homelife_posts.ID = homelife_post2cat.post_id AND ID !]
    SELECT DISTINCT ID, post_title, post_date, post_category FROM homelife_posts, homelife_post2cat WHERE category_id = AND homelife_posts.ID = homelife_post2cat.post_id AND ID != 5 AND post_status = ‘publish’ AND post_type = ‘post’ ORDER BY post_date DESC LIMIT 5

    Your help is much appreciated BTW I’m using Wordpress 2.2

    Thanks in advance
    Alex

  14. Further ideas:
    The plugin show ‘X posts from this category, or subcategory’? (If a post were in both a category and it’s subcategory, only the subcategory would be shown)

    There should be a possibility of putting the ‘number of posts found’ into the header (e.g. if the header is ‘X posts from (Category)’, but only X-1 posts are found, then X-1 should be used.

  15. Another nice plugin. Well done. One comment from me here, is that I would like the ability to not automatically add in the other categories, but to be able to choose where I want the list via a template tag.

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