Instantly share code, notes, and snippets.

@raiden808 /specific_wp_query Secret
Last active May 17, 2018

Embed
What would you like to do?
function retrieve_specific_query(){
$args = array(
'post_type' => array(hotel_services),
'order' => 'DESC',
'meta_key' => 'status',
'meta_value' => 'Pending',
'meta_query' => array(
array(
'key' => 'date',
'value' => date("Y-m-d"),
'compare'=> '>='
))
);
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
/* Restore original Post Data */
wp_reset_postdata();
} else {
// no posts found
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment