Random items order in grid gallery in Photolux theme
Question:
Is it possible to make the items in the Grid Gallery load randomly?
Original poster
Solution:
By default the grid gallery provides a “By date” and “By custom order” options. It would be easy to accomplish a random order functionality if the “Load More” functionality is not used as otherwise, it would require quite lots of additional code modifications, as there should be embedded a functionality that remembers all the currently loaded images and then load the ones that haven’t been loaded yet.
So, with a small code modification you can make the portfolio items load randomly, but without using the “Load More” functionality. In order to accomplish this, you have to open the lib/functions/ajax.php file and modify line 27:
$args=array('post_type'=>PEXETO_PORTFOLIO_POST_TYPE, 'numberposts'=>$_GET['number'], 'offset'=>$_GET['offset']);to be like this:
$args=array('post_type'=>PEXETO_PORTFOLIO_POST_TYPE, 'numberposts'=>$_GET['number'], 'offset'=>$_GET['offset'], 'orderby'=>'rand');Also, you have to make sure that the default Order By -> Date is selected for the page.
Pexeto