-
-
Save codysmith44/a072cdef9f87d68494bac7d900c8fe5d 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
<?php | |
add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { | |
if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'custom-grid-class' ) !== false ) { | |
$query_args['meta_key'] = 'field_name'; | |
$query_args['orderby'] = 'meta_value'; // better for strings | |
// $query_args['orderby'] = 'meta_value_num'; // better for numbers | |
$query_args['order'] = 'ASC'; | |
} | |
return $query_args; | |
}, 10, 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment