Tagged: Portfolio, portfolio grid, random
Hi,
I’ve searched your forum and found a couple of posts relating to this but nothing has worked.
I am using a portfolio grid on numerous pages. I would like these to display portfolio items randomly. Currently it shows them in the order that is in the back-end.
I tried this code in my functions file but this did not work:
<?
function custom_post_grid_query( $query, $params ) {
$query[‘orderby’] = ‘rand’;
return $query;
}
add_filter( ‘avia_post_grid_query’, ‘custom_post_grid_query’, 10, 2);
?>
Thanks very much :)
Hi!
That should definitely work, is that code put at the very beginning of the file? try putting it at the bottom instead (and without the PHP opener symbol).
Best regards,
Josue
Thanks I had a plugin that was interfering with this.