3

As far as I can tell, orderby="random" does not work on the new Grid fieldtype. Has anyone found a good workaround?

I have a grid with several images. I'd like to display one at a time, but randomize which image shows.

5

As of EE 2.7.3 this is possible via the native orderby="random" parameter. http://ellislab.com/expressionengine/user-guide/modules/channel/grid.html#orderby

1

I don't know if Grid has that option, but you can use our little Shoe Shine Toolbox plugin to generate a random number. Get it from Github.

With it, you can do this:

{grid-field row_id="{exp:shoeshine_toolbox:random_number from='1' to='10'}"}
  ...
{/grid-field}

Note: There are other great add-ons that can generate random numbers. Just do a search on www.devot-ee.com

1
  • I did try this approach with the "Low Random" plugin, but get php errors and no output for the field. I believe parse order is causing some grief between the Grid parameters and the Low Random plugin. – Deaconweb Nov 7 '13 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.