BuddyDev

Search

[Resolved] MediaPress – Media List shortcode randomisation

  • Participant
    Level: Initiated
    Posts: 6
    Richard Strong on #31761

    Hello,

    I understand the orderby parameter functions in the media list shortcode and have used it successfully, but it doesn’t seem to randomise entries.

    Could I get an example of how this is used / written?

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 21801
    Brajesh Singh on #31778

    Hi Richard,
    Please try using

    
    
    orderby = 'random'
    

    That should do it.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    Richard Strong on #31809

    Unfortunately it doesn’t seem to work. I tried different variations: orderby=random, orderby=’random’, orderby=”random” and none of them worked.

    orderby=modified (as an example) does but not the random option.

  • Participant
    Level: Initiated
    Posts: 6
    Richard Strong on #31810

    I had a quick google and a different variation that someone suggested does work: orderby=rand.

    So orderby=random is incorrect, at least on my installation.

  • Keymaster
    (BuddyDev Team)
    Posts: 21801
    Brajesh Singh on #31812

    Hi Richard,
    yes, ‘rand’ is the correct value.
    https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters

    I was mistaken by our internal docs. Need to update that.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved