Last active
March 6, 2018 15:16
-
-
Save MjHead/38f649b46576cf44ea48567d074dfa9a to your computer and use it in GitHub Desktop.
Add order by custom field for Smart Listing widget
This file contains hidden or 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( 'jet-blog/smart-listing/query-args', 'my_listing_query_args' ); | |
function my_listing_query_args( $args ) { | |
$args['meta_key'] = 'your_key'; // Set meta key to sort by | |
$args['orderby'] = 'meta_value'; | |
$args['order'] = 'DESC'; | |
$args['meta_type'] = 'DATE'; | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment