Support » Plugin: NextGEN Gallery - WordPress Gallery Plugin » Question about shortcodes, how to show 1 random image on a page

Viewing 10 replies - 1 through 10 (of 10 total)
  • Benjamin


    I don’t think there is a way to make singlepic load anything other than individual images. It’s a bit cludgy but the following should work:
    [ngg_images image_ids='1,2,3,4' order_by='rand()' display_type='photocrati-nextgen_basic_singlepic']



    Great suggestion Benjamin! The order_by=”rand()” works for me. Now I only need to tweak the singlepic template to get it to my liking 🙂


    Combining your two codes made it work for me, picking one random image within a gallery:
    [ngg_images gallery_ids='3' order_by='rand()' display_type='photocrati-nextgen_basic_singlepic']

    I’m guessing singlepic takes the first (or last image) and the sorting option makes it random.

    The example in the doc doesn’t seem to work (or is misleading).




    You are right Luc, maybe it would be good to add this to the documentation.

    I was having the same problem following the random image shortcode from the Photocrati site. The order_by=’rand()’ code worked for me.

    I use your code like this :
    [ngg_images gallery_ids='7,8,9,10,11,12,13,15,16,17,18,19,20' order_by='rand()' display_type='photocrati-nextgen_basic_singlepic' height='500' width='400']

    but if someone can tell me to put all galeries but exlude the 14’s ID it will be very fine !
    like :
    gallery_ids="random" exclusions='14'



    I’m having problems with the code here. Currently I’m using this code on my front page:

    [ngg_images tag_ids=’front’ order_by=’rand()’ display_type=’photocrati-nextgen_basic_singlepic’]

    It’s supposed to pick a random image with the tag “front” on it and display it as the main image on the front page. The problem is that it’s not very random. Every time I reload the page it displays the same image. Even in separate browsers it still displays the same image.

    What am I doing wrong here? It’s driving me a little crazy.

    my site:

    also, I’ve tried using random_max’1′ in place of the order_by short code and that also doesn’t work.



    @bermannyc – I’m having the same issue. It loads different images on different pages, but always the same image on the same page, so it is not randomly loading new ones on page refresh which is what I want it to do.

    Anyone get that working?



    I think it could be something related to the cache not being emptied. I know there’s been some problems with Next Gen post 2.0 update so maybe this is one of them? There was a new beta released with some cache related fixes so this could possibly be one of them?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Question about shortcodes, how to show 1 random image on a page’ is closed to new replies.