Open petranca opened 3 years ago
+1
+1
There is a hook in JetEngine you can use: jet-engine/query-builder/query/items
For example, sort a repeater query by the 'floor' field
add_filter( 'jet-engine/query-builder/query/items', function ( $items, $query ) {
if ( $query->id !== 2 ) { // Change this number with the ID of your query
return $items;
}
usort( $items, function( $a, $b ) {
return $a->floor - $b->floor;
} );
return $items;
}, 10, 3 );
Put this code in the functions.php
file of your current theme
When I insert the Repeater Listing into the Listing Grid, I cannot sort it. It always takes the order of the repeater entries. But it would also be good if I could sort by a metafield like I do with posts or taxonomies.