Created
November 26, 2021 13:20
-
-
Save MjHead/ce5c649bbe725a49ecd6f623d49a1a2f to your computer and use it in GitHub Desktop.
Add own parameters into JetEngine Listing query args
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-engine/listing/grid/posts-query-args', function( $args, $widget, $settings ) { | |
if ( 'custom-query' === $settings['_css_classes'] ) { | |
$args['meta_query'][] = array( | |
'relation' => 'OR', | |
0 => array( | |
'key' => 'submission-date', | |
'value' => strtotime( 'Today' ), | |
'compare' => '>=', | |
'type' => 'NUMERIC' | |
), | |
1 => array( | |
'key' => 'submission-date', | |
'value' => '', | |
'compare' => '=', | |
), | |
); | |
} | |
return $args; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment