Random One Cat Widget

There are times when you’d like to have a certain type of post appear in a widget for use in your sidebar or if your theme supported it, your header or footer. Random One Cat Widget allows you to do this. It will display any post, long or short, even ones containing pictures and custom fields, although it is best suited to small text posts.

On this site I use it to display a category of posts I called tips in the footer. These are normally just one liners that I sometimes add to the site, but it will work equally well for any group of reasonably small posts.

Details & Download

You can find more detail and download this Widget from the WordPress Plugin Directory.



  • KIrstie

    I am using this plugin in 2 sites.. and now in both sites the randomness is not working .. instead it just displays the latest post from that category. It seems the plugin is not compatible wioth WP upgrade?? Because it used to work. Maybe it needs an updated version? Please check, many thanks.

    • BC

      It’s working fine for the latest version of WP (4.3.1) and is tested as working on (4.4). You can see it working here in the footer and a few page refreshes will show you that the selection is random.

  • Kirstie

    Hi – I have a very strange issue – my posts and not displaying randomly – rather it is always displaying the first post in the category. I thought maybe there was an issue with the plugin installation, so I deleted it and re-installed.. but same issue.

    I am using X theme – Ethos.

    What is very strange is I am building another site using X theme – Icon, and I have used your plugin and it works fine.

    Any ideas?

    Thx so much.

    • BC

      The random selection is done using the built-in WP function and I’ve not had any issues (assuming you’re using the latest version of WP and the plugin). You can rule out the theme by switching to a default one (Twenty Fifteen for example). How many posts in that category? Does it happen with other categories?

    • BC

      This is just a normal widget. If you have a theme based on masonry then it should handle widget output for it and Random One Cat Widget will be no exception. You should speak to your theme developer if you are having trouble displaying widgets.

      • Sv9t

        not. my template is the default “loop topic”. I need to get where widget displays the articles, the articles were in the form of masonry. I do not know where in the file random-one-cat-widget.php change the code
        ps sorry for my English, I use the Google translator

  • Christine

    Thanks for the great plugin. The single “Testimonial” is a perfect use for this. Now, in the inner-right sidebar on the homepage there I’m trying to use this to pull content only from what is essentially a link list, and it works, but layout is very different to other list widgets, and while you mention in the notes above what to work with in the CSS to change the title and name (post-meta and post-meta-key), you don’t mention the content. Can you tell me how to make changes to that? If I can add to the CSS for this, that would great, but I haven’t yet been able to figure out what it’s referencing for the content, if anything. Thanks very much for your help!

    • BC

      Thanks for the feedback. Each widget is wrapped in in a div which WP have helpfully given both an id and a class. You can use that to reformat any contents (the class name is widget_random_one_cat). The content is displayed “as is” i.e. no additional formatting or html is applied to it by the widget, so it won’t give you a formatted list unless this is already in the content. It maybe that I’ve not understood – if you’d like to go into it more please drop me an email.

      • Christine

        That’s what I expected, but was unsure. I’ll see if I can work out a good method to deal with my formatting issue from here. Thanks very much for the quick reply!

  • Mike Truese

    Is there a php-type function I can call instead of using the widget.

    I want to put this into a page template (so a random quote appears at bottom of all pages) without setting up a widget area. Just a call to a php function.

    Can that be done?

    • BC

      It can be done using some of the widgets code, but not directly by calling the widget via a function because the widget requires a specific environment which isn’t available on a normal page (unless you code it in yourself, but if you do that you might as well make a widget area). The code for a stand alone function would be relatively simple to do though if you were prepared to hard code values.

  • Alper

    Hi, your tool is great but i need to use the title of post as Header and i want to use an image for post (with custom fields) so i’ve made an improvement for that purpose.
    If you want, let me send it to you..
    Finally, thank you for that great plugin again…

    • BC

      Thanks for the feedback. The widget already has the option to include the title of the post, display images and add custom fields so there should be no reason for you to update the code for these things.