Skip to content

Instantly share code, notes, and snippets.

@kaskad88
Last active December 7, 2023 21:46
Show Gist options
  • Save kaskad88/fba279e0ebfa4dbf37f3462688e8af79 to your computer and use it in GitHub Desktop.
Save kaskad88/fba279e0ebfa4dbf37f3462688e8af79 to your computer and use it in GitHub Desktop.
1) Add `random_users` CSS ID for Listing Grid widget https://tppr.me/7S5Xg
2) Add follow code to the functions.php file of child theme:
add_action( 'jet-engine/listing/grid/users-query-args', function( $args, $render ) {
if ( 'random_users' !== $render->get( '_element_id' ) ) {
return $args;
}
$args['orderby'] = 'rand';
return $args;
}, 10, 2 );
add_action( 'pre_user_query', function( $query ) {
if ( 'rand' === $query->query_vars["orderby"] ) {
$query->query_orderby = 'ORDER by RAND()';
}
} );
@kervis
Copy link

kervis commented Dec 7, 2023

@kaskad88 Is it possible to work with Ajax, or the infinite scroll in jetengine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment