Hi,
the code below works perfekt if you want display images in Masonry Galeries in random order
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;
}
But is there a posibility to display the images in random order only on certain pages. f.e. “page-id-573” and “page-id-578”
Thank you for your help
Best
Sabine
Hey ingridbrauner,
Please try using the code like this:
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' && is_page(['573', '578'])) {
$query['orderby'] = "rand";
}
return $query;
}
Best regards,
Victoria
Hi Victoria,
that’s exactly what I needed. Thank you so much for your help.
Best
Sabine
Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon