Random Gallery

Plugin Banner

Random Gallery

by David G

Download
Description

Random Gallery lets you display a different subset of your images every time your page is refreshed. Just tell it which ones you want it to pick from and how many you want to show at a time.

The Basics

Random Gallery works with an old fashioned shortcode. You specify the pool of images with the ids or category parameter. Then you specify how many you want to show with the shownum parameter.

Here’s an example of the ids method:

[random-gallery ids='101,102,103,104,105' shownum='3']

Note there are five images in the list but only three will be shown at a time.

And here is an example of the category method:

[random-gallery category='myCategory' shownum='3']

Random Gallery can handle the ordinary Gallery shortcode parameters columns, size, and link:

[random-gallery category='myCategory' shownum='3' columns='1' size='medium' link='none']

You can put shortcodes in all kinds of blocks, but it’s best to use the shortcode widget.

ids method details

The ids parameter is the list of images you want to draw from. To build up the list, you need the numbers that WordPress assigns to each of your images.

There are plugins that let you see these numbers directly in the Media Library. Try searching the plugins directory for “reveal ids”.

Otherwise, you can find them manually:

  • open up your Media Library
  • click on a photo
  • the Attachment Details will pop up
  • the URL in your address bar will look like this: https://www.example.com/wp-admin/upload.php?item=101
  • take the number at the end of the URL (in this case 101) and add that number to ids
  • repeat this process for each photo you want to include

category method

By default, categories are not available in the Media Library. However, there are plugins that will enable them. Try searching the plugins directory for “media library categories”.

Once you have categories enabled, you can create a category, add images to it, and specify it in the shortcode by name.

Curly Quotes Issue

One tricky thing to watch out for is curly quotation marks. WordPress likes to replace straight quotes (') with curly quotes (‘). This is usually a good thing, but Random Gallery can only handle straight quotes.

The easiest and best way to make sure you’re only using straight quotes is to put your shortcode in a shortcode widget, then re-type all the quotes directly in the widget.

Thanks

I hope Random Gallery works for you. If you have any trouble, just shoot me an email. Thanks!

You can add Random Gallery directly from your WordPress dashboard Plugins page or you can download random-gallery.php and put it in the wp-content/plugins/ directory of your WordPress installation. Either way, make sure you activate it from the Plugins page.

What if I have a question?

I’d be happy to help!
randomgallery@greenwold.com

What if I have a suggestion?

That would be most welcome!
randomgallery@greenwold.com

What if I find a bug?

Please let me know right away!
randomgallery@greenwold.com

DO WHAT YOU WANT

By ebuege on July 19, 2022

yes this great plugin do what you want. Gives me a tones of design alternates with random properties.. clean and lightweight code with good performance

Great plugin

By Marcel de Korte (dekorte.marcel) on February 20, 2022

Works great and is easy to work with. Hopefully the creator will keep this plugin update 🙂

It does not work

By inMountains (lawdreen) on November 1, 2021

It shows the same pictures, never change.

Great Response Time

By element30 on April 14, 2021

Author's response time is commendable. Only issue I have is once you click on an image and it expands you can't get out or see the next one easily. More options would be nice.

Does what it says!

By glynmthomas on March 28, 2021

Very happy

Fast & easy

By andrewm57 on February 25, 2021

I needed a simple sidebar gallery widget and this fits the bill perfectly. It's straightforward to use the shortcode. My sole question was answered by the developer within a few hours.

Works great with Jetpack Galleries

By jd442 on February 17, 2021

I use this plugin to create Jetpack galleries that display random images from my media folder. The shortcode made it easy to set up.

Greatest work!

By metapoic94 on August 17, 2018

Thanks for this pretty plugin, I used when I've tried to add rows in my gallery shortcode, thanks for that body <3

SO simple and perfect for my needs

By patbell101 on October 6, 2017

No-one watches a slideshow for more than a few images, so this is perfect. My users argue ast to what to show so this is the perfect solution. Great support too

Nice script

By AngusMcKinnon on January 29, 2017

Does what it says and works well. Would have given it a 5 but had to come back here to work out what I needed to paste each time to change the gallery format in the text view. Maybe I missed something in the script that does this from within the site.

00.08

Adds support for PHP 8. Drops support for Gallery shortcode parameter ‘type’. Updates the readme and testing.

00.07

Bug fix: categories no longer limited to a shownum of 5. Updated the readme and testing.

00.06

Added support for categories. Added a donate link. Updated the readme and testing.

00.05

No change to the code. Just updated the readme and testing.

00.04

No change to the code. Just updated the readme and testing.

00.03

No change to the code. Just updated the readme and testing.

00.02

Added support for type, columns, size, and link.

Miscellaneous code and documentation improvements.

Fixed bug that was forcing the gallery to the top of the page.

00.01

Added header and comments.

00.00

Just the code. Made for and deployed on client’s website.

Back to top