Title: Image Carousel &#8211; Load Random Image?
Last modified: May 8, 2020

---

# Image Carousel – Load Random Image?

 *  Resolved [tjdyo](https://wordpress.org/support/users/tjdyo/)
 * (@tjdyo)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/image-carousel-load-random-image/)
 * Is it possible to get an option to load an image randomly with the Image Carousel?
 * I am using the image carousel to display a square image in a widget spot that
   slides between images.
 * I need this function to be random, as we are using this spot to load “albums 
   of the week” and it needs to display a different album first on each load of 
   a page.
 * I’d be happy to donate to receive this added feature!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Vova](https://wordpress.org/support/users/gn_themes/)
 * (@gn_themes)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/image-carousel-load-random-image/#post-12804718)
 * Hi [@tjdyo](https://wordpress.org/support/users/tjdyo/),
 * this will be possible after the closest update, in a week or less.
 * You’ll need to do add a custom CSS class to your shortcode and add the following
   snippet to the `functions.php` file:
 *     ```
       add_filter(
       	'su/get_gallery_slides_query',
       	function( $query, $source, $atts ) {
   
       		if ( ! isset( $atts['class'] ) || strpos( $atts['class'], 'random-image' ) === false ) {
       			return $query;
       		}
   
       		$query['ignore_sticky_posts'] = true;
       		$query['orderby']             = 'rand';
   
       		return $query;
   
       	},
       	10,
       	3
       );
       ```
   
 * And this is the example of what CSS class you should add:
 *     ```
       [su_image_carousel class="random-image"]
       ```
   
 * You can donate by purchasing any of the premium add-ons [here](https://getshortcodes.com/add-ons/).
 *  Thread Starter [tjdyo](https://wordpress.org/support/users/tjdyo/)
 * (@tjdyo)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/image-carousel-load-random-image/#post-12841518)
 * For some reason this didn’t work for me. Can’t wait for the update, and I definitely
   will buy a premium addon. Thank you for the great support!
 *  Thread Starter [tjdyo](https://wordpress.org/support/users/tjdyo/)
 * (@tjdyo)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/image-carousel-load-random-image/#post-12894530)
 * Any chance that update is coming soon? The last update didn’t include the feature
   to randomly load the images I choose.
 * I need to be able to pick 2-10 images and have it randomly start with one per
   page load. I added the code to my functions.php and added the class to my shortcode,
   but nothing changed.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Image Carousel – Load Random Image?’ is closed to new replies.

 * ![](https://ps.w.org/shortcodes-ultimate/assets/icon-256x256.gif?rev=2547563)
 * [Shortcodes Ultimate - Content Elements](https://wordpress.org/plugins/shortcodes-ultimate/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcodes-ultimate/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcodes-ultimate/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcodes-ultimate/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcodes-ultimate/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [tjdyo](https://wordpress.org/support/users/tjdyo/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/image-carousel-load-random-image/#post-12894530)
 * Status: resolved