Category Posts Widget 3.0

This latest update introduces a few new features:

  • Support for WordPress 2.9’s post thumbnails.
  • Option to show the post date.
  • Option to show the comment count.
  • Option to set the word length of the excerpt.

Note that support for Simple Post Thumbnails has been removed in favor of the built in functionality.

You can download the plugin at the WordPress plugin repository: Download here.

Please donate if you find this plugin useful.

Update: Several people have been reporting an error “Warning: Invalid argument supplied for foreach()…” I just pushed out version 3.1 which should fix this. This bug could have been fixed if I had done some more rigorous testing. I’ll do better next time.

This was posted on December 30, 2009. It’s a prose on cpw, plugins, and wordpress. CommentsHope you like it.

  • tommytickles
    I'm an idiot, but can you insert the plugin directly into a post with a shortcode? ......everyone starts somewhere, please help
  • Barb A. Ryan
    Hi James,

    I like your category post widgets. I use multiple instances of it to organize my sidebars by category and to direct readers and spiders to the posts that I think are most important on my sites.

    However, I have stuck with version 2.3 and I avoid updating. The reason is that I hacked your 2.3 code to get the posts to display alphabetically within each category. I am not much of a coder, but I remember finding a comment somewhere that gave me enough of a hint on how to do it.

    Here is the code snippet I use:

    // Get array of post info.
    $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"] . '&orderby=title&order=asc' );

    echo $before_widget;

    Is it possible to incorporate this into an upcoming version either as the default or as an option? If you did, then I would upgrade.

    Thanks again,

    Barb
  • Fantastic plug-in! I'm trying to alphabetize the posts underneath each category but haven't had any success. I tried editing the category file as you mentioned below with: $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"] . '&orderby=title&order=asc'); but it didn't work. Any ideas? TIA.
  • James -

    stellar work. I've had this installed for a quite a while (and am not using v. 3.1), and since the beginning I've only successfully limited the posts listed in the widget to 5 on only the main sidebar. On post and page sidebars, it lists ALL posts in the category. Is this a problem that originates with my theme (Tarski 2.5)?

    On my website it's being used to show the "Latest Books Added."

    Thanks!

    Conrad
  • Carl
    Thanks for the great plugin! You're a lifesaver!
  • I dowanloaded the plugin but when trying to change the option I realized that the thumbnail option does not exist. The screenshot you have iwth the plugin does not look the same.

    I deleted the plugin and reinstall but still the same.

    Can you please help?
  • Hi,
    Is there a way to make the posts appear in alphabetical order according to the title?

    Thanks,

    John
  • SIssi
    John, James was wonderful enough to forward me the code for alphabetizing. This snippet should be edited into your cat-posts.php file:
    // Get array of post info.
    $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"] . '&orderby=title&order=asc' );

    echo $before_widget;
  • Sue Jaymes
    I get a message saying "are you sure you want to do this" Please try again later .....
    ????
    Any ideas? I am up to date with wordpress upgrades etc.
  • ntarantino
    Did the 2.9.2 update create an issue with the excerpt? I can´t seem to get it working now... the only thing I can think of was updating this morning
  • Camelot
    How can I use the plug-in in other places, not only as a sidebar widget, for example, in the body
  • jerome robins
    hi, is there a way to have it display in alphabetical order?

    thanks.
  • Dean N
    Excellent plugin. I do have a quick question though. Is there an easy way to format the thumbs horizontally like you have done with your "recent photos" section on your home page? I don't see an option to choose a horizontal display, my install seems to stack the thumbs vertically. I'd like to do something almost identical to how you have your recent photos with the thumbs running horizontally.

    Thanks!
  • rowanhb
    Great plugin, works perfectly. BUT - can I edit the amount of space between the post title, date and post excerpt? Too much space at the moment.
  • James, I am also having some issues with spacing. I would like the post-date to appear on the same line as the excerpt, however, after hours of css and snippet replacements I am still stumped. Please help =)
  • Parker
    James,

    Seems like a lot people would like to know how to change the position of image. For example have the image first follow by Title. Can you please give us a hint.
  • Hi James, I love your plug-in, thank you. Really great that it uses the new wordpress thumbnail function.

    I would like to be able to turn the post title on and off in different instances of the widget. I'm using it in some cases where I just want thumbnails but other cases where I want news titles.

    I know how to comment out the title for all instances but is there a way I could add in a variation so I can choose whether or not to display the post title?

    Thanks
  • gallbladdersurgery
    Update. I see what happened. The sticky posts (which are older-dated) appear at the top. So it was nothing to do with your plugin. I bet you knew that already!
    Cheers.
    Gary
  • gallbladdersurgery
    Oddly, it seems that this plugin has reversed the display order of my posts. It used to be the newest at the top, now it's the oldest at the top. Bit weird, eh.

    I did go through my published posts and add a new category for the posts that I want your plugin to pick up, then I went through and stickied some of those posts. Could that have been the reason for this?

    Gary
  • designdiva2006
    HI, I am using category post and I am trying to embed flash video. the video shows fine on the single post page but doesn't show on the sidebar. Is there something that I need to add?
    Thanks
  • jlao
    The widget only shows an excerpt which strips out any Flash video. This is something WordPress does automatically.
  • Ryan Bell
    I installed the plugin and set up my category. When you click on the post from the widget it goes to my about page and not the post. Any ideas?
  • nomadhermit
    Hi James. Thanks for a great plugin. The problem I'm experiencing is that the post links are not aligning with the category title in the sidebar; any idea why this should be so? It's for a small non-commercial site I'm setting up for a friend who's a painter.

    Thanks for your time

    UPDATE: It wasn't your plugin, it was the theme - problem solved. Thanks again
  • jarga
    Hello

    I like your plugin ! But I want to control the style and don't understand where is the stylesheet.. ? I desperately search the <class="cat-post-item"> and <class="post-title>...

    Thanks for your help
  • jlao
    There is no stylesheet. Just add whatever styles you want to your theme's style.css file.
  • garnethg
    James, I've just tried out your Category Post Widget. My site is quite new, and I'd been posting since around Christmas. I hadn't been doing any categorizing at all until this weekend, though; and after catching right up to my latest entry, I realized that no categories were being displayed on the site, despite the work of doing so much categorizing.

    When I began configuring your widget, it displayed the very first category of my categories in the category drop-down box, so I thought that I must have to "configure and save" for every category listing I have. So I did so.

    But my site still has no category display -- just a list titled 'Important Information' displaying 10 post headings; and further down, a 'Featured' area with an excerpt of one of my posts.

    What has bothered me about my site is that not only is there no full category display, but the post titles show randomly. That is, iIf any page of the site is refreshed, the post titles listed in the 'Important Information' will change to a new collection of titles.

    I am at a loss on how to get this straightened out.

    The way it is now, there is no rhyme nor reason to the site. Anyone coming to it will have no idea what posts may be buried away in it, apart from the 10 titles on display. They may think that there is nothing else in the site. Heck, I don't even know how to locate any of the other posts, apart from refreshing a page over and over and hoping the post title will randomly appear in the 'Important Information' list.

    But no one else is likely to know that this can be done to see a new set of post titles. And why would anyone bother, even if they did know? It's just too haphazard, and doesn't lead to anything specific.

    The hope was that your widget would bring order to the chaos, but the challenge seems far too formidable.

    Any suggestions at all?

    Thanks.
  • I am using Category Posts Widget 3.1 and really like it. BUT when I check "Make widget title link" it does NOT display the "Title" until the mouse hovers over the Title bar and then it is displayed in a very lite white. HOW can this be changed so that the "Title" is displayed exactly as it would be without this option and then shows as a link when the mouse hovers over it? In my case the Title bar is a dark color with white letters.
  • carl
    Where are thumbnails??? Was a great plugin. Now is one more plugin like much more... :(
  • Any clue as to how to get the text to wrap the image? I moved the code so that at least the image now appears below the Title and Data but that big huge gap of air there...

    Great plug-in which is more than can be said about a lot of others....

    Any ideas, on how to get <p style=align textleft or right for that matter?
  • Hi1 Thanks for this great plugin! I've used it in my blog, and used as an inspiration an a base to develop another plugin, hope you are ok. :-)

    Here is the link: http://www.nightdrops.com/2010/wordpress-widget...
  • This one would had been interesting for me if it was not only possible to use as a widget, but also directly on pages and posts.

    List Category Posts does this, but for some strange reason I cannot get all the short code parameters to work. Also, it lacks the thumbnail feature.

    http://wordpress.org/extend/plugins/list-catego...

    If you are thinking about the next step for this plugin, consider making it available for pages/posts as well. Would make a good plugin even more versatile and useful.
  • Jane
    I am having the same problem as Len - my thumbnail images were displaying fine (left-aligned) before the Wordpress 2.9 upgrade, and now are displaying straight after the post title or under it, depending on the length of the post title.

    http://saucybeige.com/WLH/snooping/

    James, could you please give any tips on how to modify the plugin?

    I've tried doing it through the Style Sheet but with no luck...

    Thanks
    Jane
  • Dave
    Jane, I just checked out your site and it looks like you resolved the thumbnail positioning problem. I would also like to display the thumbnail to the left with the text to the right. Just wondered if you could let me know how you modified the plugin.

    Many thanks
    Dave
  • RG
    I'm sorry however, I do not see the function for the images/thumbnails

    I also looked to place 'add_theme_support( 'post-thumbnails' );' into functions.php and since it isn't really clear whether this is to be placed within the themes functions.php or MU's functions.php...

    Could someone be a little more succinct as to how to implement this fix... thank you
  • Troy Arnold
    Help. Got the stylesheet issue resolved and love the plugin but for some reason it is only showing 10 posts, not 12, etc. I want to be able to show as many posts and define the limits but even with it set to 0 it shows only the top 10 posts. If I set it to 12 it ignores that setting and shows the latest 10 posts. Any help would be greatly appreciated. Thanks!
  • Troy Arnold
    Also having the same problem with the excerpt length... any idea why this isn't functioning properly? it's just showing the full post. Thanks!
  • Troy Arnold
    Love the plugin but can't figure out how to style the placement of the thumbnail. It shows up but it is to the right of the post text. I would like it to the left with a little padding and the text to be middle aligned to the right. Any input on how I can make this adjustment? Thanks in advance!
  • Len, you'll have to modify the plugin.
  • Len
    Hi: Like your widget - but having issues with the thumbnail placement. It seems to place the image under the text excerpt instead of next to it (like to the left) Any ideas on how to adjust?
  • Anybody? I would like to use this in a custom template. How do I manually add it to the sidebar?

    Thanks.
  • @Mike .It would be great if this plugin could achieve this. I found an alternate solution to including in my template. Hope this helps.

    http://www.kimwoodbridge.com/wordpress-how-to-l...
  • Hello.

    How can I use this without using the widget? I will be adding to the sidebar of certain pages only.

    Thanks.
  • Thanks Brett so much for pointing this out! (about the new Wordpress 2.9 Thumbnail upload for each post)

    It's a pain in the butt to have to upload all the Thumbnails again through Wordpress Media Library and "set as Thumbnail" but at least they're showing up now!!

    Cheers
    Jane
  • Hi James

    I have a problem. I would like the excerpt text to appear next after the thumbnail, not at the bottom of it. The thumbnail appears at left, so I want the text to be at right, but I`m not able to do this. If you could help me...

    Thank you, good job
  • Hi, thanks for your plugin!

    It's all working great except for the option to set the excerpt length -I've set it to 10 words but the full excerpt still displays... any ideas?

    http://saucybeige.com/WLH/?cat=3

    Thank you,
    Jane
  • Hi James, great plugin! But I'm having some issues with it. :)
    When I activate plugin, and then try edit uploaded images (with new image editor in wp2.9), I don't get full image preview, only part of image, but dimensions are accurate.
    If I deactivate plugin, then it works fine. Any ideas?
    Thanks.
  • dolly
    about what theme do you talk, james ?? is in admin section wordpress the problem!! not about a specific theme..
  • I found that even if you had thumbnails set up before, you have to go back into your posts, and use the NEW wp 2.9 thumbnail setting option (right side of sidebar inside wp-admin area).

    Would be cool if this had a check box option to use the old way or the new 2.9 way.
  • Hi, James. Great plug-in! Solved a few design problems for me. I'm building a site with it but can't get the images to right justify in the widget. You can see an example at http://mediazoic.info/byrnesmedia/ in 'Tips From the Experts'. Any idea of how to fix this?
  • Darren, the only thing I can think of is that you didn't add thumbnails to your posts which you can do on the post edit page in the right sidebar.
  • OK, inserted add_theme_support( 'post-thumbnails' ); to custom_functions for Thesis. I then had the thumbnail info available on the widget settings. I set thumbs to 100x75, saved and I do not get the thumbs to view. Any thoughts on what I can do next? Thanks again James!

    -Darren
  • Thank you very much James!
  • Your theme has to support the new post thumbnails feature in order for the option to appear. You can do this by adding the following line to your theme's functions.php file:

    add_theme_support( 'post-thumbnails' );
  • Just found out about your plugin, but for the life of me I can't figure out how to make the thumbnails work. Using 2.9.1 Wordpress with Thesis. In the config settings there is no option for thumbnails??? Is it located somewhere else?
  • dolly
    hi. great plugin ! in version 3.1, show thumbnail (in admin widgets section) is missing.. why?
  • Jan
    Don't get the images to work?

    Am I doing something wrong?
  • Tim
    Great plug-in, saves the day.

    I however suggest a fix at cat-posts.php at line 87: instead of the_time('j M Y'), use the_date() to honor WordPress date format config.

    ref: codex.wordpress.org/Template_Tags/the_date
  • Thanks. I would like to make the category list sorting. It's possible?
  • eof
    @lena - I needed to sort out the posts and simply added a few parameters into a query, find the line:
    $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"])

    It wasnt an elegant solution but works perfectly for my purposes, check my version:

    $cat_posts = new WP_Query("showposts=" . $instance["num"] . "&cat=" . $instance["cat"] . '&orderby=title&order=asc');

    This is quic'n'dirty one, You can change the last parameter into some conditional logic, which should be pretty straightforward here :)
  • Works perfectly once again, thanks a bunch!
  • Great Plugin. I would like to make the category lists in BOLD. IE "" how would I do that in the plugin php file? thanks.
  • Camelot
    Thanks, the first plugin that works as promised. But I was happy with version 2.3 because the integration with Simple Post Thumbnails was very successful. Could provide an opportunity for those who use it continue using in the future whilst enjoying the new features?

    Incidentally, I believe that the new version are not working the excerpt length
  • Category Post text on widgets all of a sudden got huge. don't know what happened.

    I installed the update and no luck on a fix

    too bad, I loved this feature

    wish I knew what happened
  • fyi, with the update i'm getting this error:

    Warning: Invalid argument supplied for foreach() in /home/.saber/paperpetual/paperpetual.com/wp-content/plugins/category-posts/cat-posts.php on line 15
  • The latest update to category-post crashed my site. Is the older version available for download somewhere?

    Thanks
blog comments powered by Disqus

back to the top