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. Ooops, I spoke a little too soon. The code you suggested only excluded the plugin from displaying anything if the first category was the one in the if statement. I wanted it to skip that category and list for the next category the post is listed under. (Also, it could be useful to list the latest posts in other categories that the posts belongs to also for multi-category posts, but I didn’t implement that. It would require a loop).

    I added a little more code and shifted the position of the code to go before the header so the proper category name would be displayed. Here is the code:

    
    	$c_post = $post-&gt;ID;
    	$c_cat = get_the_category(); 
    	$c_cat = $c_cat[0];
    
    	$curr_cat_id = $c_cat-&gt;cat_ID;
    	if ($curr_cat_id == 5) {
    	$c_cat = get_the_category(); 
    	$c_cat = $c_cat[1];}
            $curr_cat_id = $c_cat-&gt;cat_ID;
            if ($curr_cat_id == 5) return "";
    
    	// fix up header
    	$ddop_header = str_replace('%C', $c_cat-&gt;cat_name, $ddop_header);
    

  2. Thanks, that works well!

  3. Mark: Sure. Here is one way. Find this line in the script:

    $curr_cat_id = $c_cat->cat_ID;

    After it, add this:

    if ($curr_cat_id == 30) return "";

    Where 30 is the id of a cat you want to exclude. You can duplicate this line for other cat ids as well. It is not the most elegant way, but it works ;)

  4. Nice plugin!

    Is it possible to exclude a certain category from displaying? Most of my posts are under one top category and then subcategories underneath and I want to exclude the category that they all belong to so I can highlight the subcategory related posts.

    Thanks!

  5. Jade: Glad you like it :) Thanks.

  6. COOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOL!

    Thanks for the quick reply. Yeah, I was trying to find the code where it says where to put it, but I guess I didn’t look hard enough. I understand only basic php, and now that you’ve pointed it out It seems obvious, then again, you did write the damn thing. Well it works great now and I’ll be sure to reference this site.
    Thanks!

  7. Jade: No problem. First, find the ddop_generate function in the file. Then replace this line:

    return $content . ddop_show_posts();

    With this:

    return ddop_show_posts() . $content;

    And it will show the output above the posts :) Just make sure you have your options set to display it on every page.

  8. Is there anyway to put the output at the top of the post rather than the bottom? Ideally it would be where the “previous , next” links are in the default theme. The only solution I have is to delete the preV/next tagS in the template, then place the tag at the top of my post and Float it right. But is there anyway I can call the output from the template so I don’t have to put the: in every single post ?

    I appreciate any input, and regardless. great plugin, THANKS!

  9. Sam: Very good! :)

  10. Thanks again for your help, Admin! I have the issue resolved. It was a conflict with a restrictions plugin I’m using. Thankfully, I decided a few weeks ago not to use that plugin, so the clash is a moot point!
    cheers
    SAM :)

  11. Thanks for your quick reply! I already tried both those options but still nothing was generated. Any other ideas?
    SAM :)

  12. Sam: The two main options are to either enable the plugin to display at the bottom of posts by checking the ‘Show at the bottom of every post’ setting in this plugins option spage, or manually insert this line in the post itself (not the template):

    <!-- ddpostsfromcat -->

  13. Hmm, looks like a great plugin! However, I’m not getting any output displayed on my posts. Does something specific need to be in the single.php template? WP 1.5.3-1beta.

  14. I’m always looking for different ways for readers of my blog to view the posts. Since I am a teacher of sorts, this provides a way to help the reader navigate once they read a post in one of my teaching categories. I hope it will be useful to them. Thanks.

  15. Another one that works exactly as outlined here, with no hassles at all to get up and running! Thank you!

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.