Is it possible to have random images from the categories selected in either the Masonry full width or portfolio grid?
I wanted the front page of my website to have random member images displayed from several hundred and don’t want the same ones at the front every time.
Hey rodpascoe!
Try with this, open this file /config-templatebuilder/avia-shortcodes/masonry_entries.php:
Replace this line (287):
$query = array( 'orderby' => 'date',
By this:
$query = array( 'orderby' => 'rand',
Cheers!
Josue
Hi!
I got the same issue, would like to get random thumbs on my Portfolio grid.
But the solution above doesn´t seem to work for me? Any other ideias?
Thanks, best regards
Hi!
That will work only if you are using the masonry element, for the grid element you’d need to change this file /config-templatebuilder/avia-shortcodes/postslider.php, line 458.
Cheers!
Josue
Hi!
Try to insert following code at the bottom of functions.php
function custom_post_grid_query( $query, $params ) {
$query['orderby'] = 'rand';
return $query;
}
add_filter( 'avia_post_grid_query', 'custom_post_grid_query', 10, 2);
If it still doesn’t work try to deactivate all third party plugins – maybe a plugin hooks into the query and changes the order.
Regards,
Peter