-
AuthorPosts
-
June 11, 2015 at 9:43 am #457681
https://kriesi.at/support/topic/masonry-gallery-how-to-sort-by-random/
This topic is unfortunately closed, but the solution provided in it doesn’t work anymore after recent updates :/
June 11, 2015 at 6:38 pm #457968Hi iheartwine!
When you edit the shortcode scroll down and you’ll see the “Order by” option which you can set to “Random”. This was added in one of the later Enfold versions.
Best regards,
ElliottFebruary 28, 2018 at 4:09 pm #919130Hello Elliot and Dude,
the solution works for me but I cannot use it for only a certain gallery. It would affect all galleries.
So how can I randomly sort only one gallery? (e.g. with a custom_class)add_filter('avia_masonry_entries_query', 'avia_random_image_query', 10, 2); function avia_random_image_query($query, $params) { if(!empty($query['post_mime_type']) && $query['post_mime_type'] == 'image') { $query['orderby'] = "rand"; } return $query; }Kind regards Axel
-
This reply was modified 7 years, 8 months ago by
doppelaxel.
February 28, 2018 at 5:09 pm #919171Hi,
You might want to add some conditional tags to filter the pages where you want it to apply, please refer to the wordpress codex: https://codex.wordpress.org/Conditional_Tags
Let us know if this helps :)Best regards,
NikkoFebruary 28, 2018 at 11:03 pm #919309Thanks for your quich reply Nikko.
But the two galleries are one the same page. Only one of them should randomly display. Therefore I need to filter an id or similar. Is this possible?
Or maybe a custom class?Kind regards Axel
March 1, 2018 at 12:56 pm #919595Hi Axel,
I see that’s pretty complicated though it’s possible, it would take some time to do it and outside the scope of our support. :(
Best regards,
NikkoAugust 18, 2018 at 1:51 am #998607Should be able to set a class or ID to the section where your gallery is and with some creative conditionals targeting said class or ID, you should be able to do this. I haven’t tried, but in theory it should be more than possible that way.
-
This reply was modified 7 years, 8 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
