Random sorting doesn’t work when only displaying a few photos

Instagram’s API doesn’t allow us to request photos in a random order and so the way the random sorting feature works in the plugin is that the plugin gets the number of posts you specify from Instagram and then sorts them in random order. This works well when displaying a larger number of photos but when displaying only a few photos then the plugin only has a few photos to use to display in random order.

The workaround for this is as follows:

1) Set the number of photos on the plugin’s Settings page to be 33 (the most you can retrieve from Instagram in one request)

2) Use the following shortcode in your page/widget, changing the number in the class option to match the number of photos you want to display:

[instagram-feed class=show3]

3) Add the following to the plugin’s Custom CSS section, which is on the plugin’s Customize page:

#sb_instagram #sbi_images .sbi_item{ display: none; }

4) Add the following to the plugin’s Custom JavaScript section:

jQuery('#sb_instagram.show3 .sbi_item').slice(0,3).css('display', 'inline-block');

The number in the show class and the slice(0,3) parts should be the same. If you are displaying more than one feed then you can add a line here for each class you added to the shortcodes in step 2.

That should then show 3 random photos from the latest 33 photos in your Instagram account.