I am creating a Kalium page which displays my work (portfolio items) similar to how it is done in the Remi LeBlanc page. However, I would like the grid to be randomized upon loading and was wondering if there is a way that this can be done within the theme.
I am creating a Kalium page which displays my work (portfolio items) similar to how it is done in the Remi LeBlanc page. However, I would like the grid to be randomized upon loading and was wondering if there is a way that this can be done within the theme.
Hi,
If you want to randomize the order of projects add this code in functions.php
function kalium_portfolio_query_random_order( $args ) { $args['orderby'] = 'rand'; return $args; } add_filter( 'kalium_portfolio_query', 'kalium_portfolio_query_random_order' );If the portfolio projects are showing in homepage and other pages as well, you can apply random order on homepage only with this improved code:
function kalium_portfolio_query_random_order( $args ) { if ( is_front_page() ) {
$args['orderby'] = 'rand'; }
return $args;
}
add_filter( 'kalium_portfolio_query', 'kalium_portfolio_query_random_order' );
This should work for you.