Created
July 29, 2022 09:53
-
-
Save elias1435/b96dcedcf57f89009e58fe8730d54bf2 to your computer and use it in GitHub Desktop.
Elementor - SORT POSTS BASED ON A CUSTOM DATE FIELD
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
/* Sort Posts by Custom Date Field */ | |
add_action( 'elementor/query/event_sort_date', function( $query ) { | |
$query->set( 'meta_key', 'event_date' ); | |
$query->set( 'orderby', 'meta_value_num' ); | |
$query->set( 'order', 'ASC' ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment