Last active
December 7, 2023 21:46
-
-
Save kaskad88/fba279e0ebfa4dbf37f3462688e8af79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()'; | |
} | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@fbeach73 Could you please attach a screen or video of your steps ? Are you using the Query builder for user listing?