Created
May 15, 2021 23:09
-
-
Save flyingwebie/9fd3a530270927da766a509007302a31 to your computer and use it in GitHub Desktop.
Custom WP_Query for EasyPost and Repeater in Oxygen Builder
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
/* Put this in a code block just BEFORE the repeater */ | |
/* WP_Query Reference: https://github.com/luetkemj/wp-query-ref */ | |
<?php | |
add_action( 'pre_get_posts', 'custom_query_name' ); | |
function custom_query_name( $query ) { | |
$cpt_id = get_queried_object_id(); | |
$query->set('meta_query', array( | |
'key' => 'auction', | |
'value' => $cpt_id | |
), | |
); | |
$query->set('orderby', 'number'); | |
$query->set('meta_key', 'number'); | |
$query->set('order', 'ASC'); | |
} | |
?> | |
/* Put this in a code block just AFTER the repeater if you need to make other queries later on the page */ | |
<?php | |
remove_action( 'pre_get_posts', 'custom_query_name' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment