Sillybean

Random Posts from Category

This widget will list random posts from a chosen category. You can choose how many posts to display, and whether to show the excerpt or the full content in addition to the post title. You may also link the widget title to the category archive if you like.

Download at wordpress.org »

Report problems using the support forum »

Random Posts from Category widget screenshot

Random Posts from Category widget screenshot

Translations

Belorussian (be_BY) by FatCow.

30 comments

Sharing this post? The short URL is: http://sillybean.net/?p=2399

30 Responses to “Random Posts from Category”

  1. Adam Kayce says:

    This is an awesome plugin. I’ve been adding my own php code to the sidebar file to make this happen, but that limits the flexibility of where it can display, unless you get into hacking in extra widget areas (blah), and takes a bunch of extra time.

    Your plugin does exactly what I was hoping for, and does it perfectly. 5 stars.

    (by the way, I don’t know if you’ve seen Chris Pearson’s post about this at Pearsonified, but that’s where I got the idea and the code from… I bet his community—the Thesis crowd—would love to know about this plugin.)

    • Stephanie says:

      Thank you so much! I’m glad it was useful.

      I have not seen Chris’s post, but I’m considering using Thesis for a project myself, so that community might well include me by this time next week. :)

  2. Pande says:

    Would be great if the category were dynamical, I mean if I’m in a post show me the category it belongs… if I’m in a search show me the cat. of the first post, etc…
    Regards.

  3. Stephan says:

    I would also love to be able to use this with pages!

  4. Maria says:

    I’m looking for a Random Post by Tag plugin that enables me to specify the number of random posts and the tag they should match. I’ll be manually inserting it in my theme, so I don’t want a widget. If you know of anything like that or can write it, please let me know.

  5. eren says:

    What is manuel adding code ? My theme isnot widget ready, please help..

  6. Deniz says:

    how can i use it without widget ?

  7. Jon says:

    Excellent plugin, just what I needed! Wondering if you could shed some light as to where/how the excerpt length can be controlled within this widget? Is it using the default wordpress excerpt length? Dug around in the PHP a bit but couldn’t work it out.

    Thanks in advance for any help, and thanks for the plugin all together!

    • Stephanie says:

      It does use the default excerpt length, unless you have the_excerpt Reloaded installed. Then you’ll get a couple of extra option fields, including the length.

      WP 2.9 includes support for customizing excerpt length as well as the [...] at the end.

  8. Lynne Robson says:

    For some reason it only seems to be picking up the most recent post in the category…

    I also have your recent post plugin active…could they be conflicting?

  9. Lionel says:

    A nice widget. Thanks a lot.

    I need to put this wodget manually in my html-code. Can you give me a php-code which launch this pluging. Instead a sidebar option in WP. Please!

  10. Ys says:

    Nice plugin
    but is there any way to also make the category random, I mean I just want a bunch of random posts from various categories ?

  11. Stephanie says:

    Lynne, I’m pretty sure I’m using the two on the same blog without conflicts. I’ll double-check, though.

    Lionel, it’s in the works, but not yet.

    Ys, no, there are other plugins that display random posts from any category. This one is more specific.

  12. Todd Googins says:

    Stephanie,

    I am having the same problem as Lynne Robson. It is definitely only showing the most recent post pulled from a category. How can I fix that so that it is truly random?

    Thank you so much for your plug-in.

    Todd

  13. Plug-in is awesome but I am trying to figure out how to change the excerpt so that it does not display so many characters. Is there a viariable I can change? Is that an option you might soon incorporate?

    Good job.

    Stu

    • steph says:

      Stu, if you’re using the_excerpt Reloaded, you’ll have an option right in the widget itself to limit the number of words. Otherwise, you can put a few lines of code in your functions.php file. However, with that method, you’ll be changing the lengths of all your excerpts across your site, not just the one shown in the widget.

      • the site is at http://sodeepdemo.ofyourwebsite.com and I do not understand what you mean by “the_excerpt Reloaded”. I see the code in the Widget Editor but I am not a programmer. So, I don’t know what to do. As I am using your plug-in, I do not have an option to limit the number of characters. And I don’t want to make a global change to the website.

        Sorry if I am being a pain.

        Stu
        202-462-4290

  14. Wow. That was simple and it works. Thank you so much for your help! :)

    Stu

  15. David says:

    Hello,
    Thank you very much for this plugin it’s perfect !
    I have a question :
    I use custom fields in every posts. How can i put custom fields in this plugin ?

    The exemple below doesn’t work…
    Ex:
    ID, “apercu”, $single = true); ?>

    Thank you very much Steph !!
    David

    • Paul Widdershoven says:

      Is it possible to modify the code to include -custom field value of the random post must also equal the value of the post.

      If I could be so bold – If so what would be the code?

  16. Craig Paterson says:

    Stephanie, many thanks for the great plugin, although I am having the same issue as Lynne Robson except it is only first post published in the category which is being picked up and used.
    I don’t suppose you have any ideas what could be causing this to happen?
    Thanks in advance,
    Craig

  17. Lana says:

    Hi . . . This is a great plugin!

    I was wanting to know if something is possible? I am using the plugin in the fotter of my pages and haved edited it to include the gd star rating and the image for the random post.

    Problem: I decided that instead of using

    to get the image placed into the content of the post, I have coded my theme to show all images in the gallery using . . .

    Since changing to using the gallery code, I cannot get an image to show in your plugin.

    Goal: Would you have any suggestions as to what code to use to accomplish showing the first or last image, and what could be the only image in the gallery attached to that random post, in your plugin? I know just enough php to be dangerous. lol

  18. Lana says:

    apologies but the code tag did not seem to work.

    was using:
    ?php get_the_post_thumbnail( $id, $size, $attr ); ?

    trying to use but not working:
    ?php echo do_shortcode(“[gallery]“); ?

  19. David says:

    Hello Steph,
    I use “Simple Post Thumbnails” and i want to include the thumbs for each post from “Random Posts from Category”

    I tried this code but it doesn’t works :
    img alt=”?php the_title(); ?” src=”?php echo p75GetThumbnail($post->ID, null, null); ?” border=”0″ /

    Thank you for your help.
    David

  20. Foad says:

    hi, thanks for this plugin.

    when i use this plugin for one of my categories with 1300 posts it’s not work.but when use for other categories whit less post it’s work wery well. what can i do for this problem?

    thanks for your help.

  21. how to display manual this plugins, what code to use, for example i want display on the search page

    thanks

  22. StephK says:

    Is there an easy way to get this plugin to show custom post types instead of regular posts?

  23. StephK says:

    I answered my own question – it was very easy! I modified the query to include post_type=any

  24. Paul Widdershoven says:

    Is it possible to modify the code to include -custom field value of the random post must also equal the value of the post.

    If I could be so bold – If so what would be the code?