Hi,
I want to have the portfolio items sorted randomly in portfolio grid on every page load. I added this code to functions.php.
function custom_post_grid_query($query)
{
$query['orderby'] = 'rand';
return $query;
}
add_filter('avia_post_grid_query','custom_post_grid_query');
Problem: when I go to page 2 of portfolio grid there is a new mix of portfolio items. It can happen that I don’t see a single portfolio item, because on first reload it is on page 2 and on the second reload ist is on page 1.
Is there a way to change the sort order randomly on reload of home page (location of portfolio grid), but not when switching from page one to page two (or 3 or 4)? So only on first reload, but until I reload the home page again every switch should not change the sort order so that I have the chance to see all portfolio items.
Best regards,
Tom
Hey Tom,
I’m afraid that’s not easily possible. If this is something important for you, please consider to hire a freelancer for the task.
Best regards,
Yigit
Hey Yigit,
thanks a lot for your message. It’s not important as it is a web site for hobbyists, but it would have been a nice to have. So we will use the random sort order, but not the pagination.
Best regards,
Tom
Hi,
Glad Yigit could clarify this and you are able to work around it, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike