Home › Forums › General Issues › Using date picker to show dates in future on one page › Reply To: Using date picker to show dates in future on one page
Hi @duuuaaaane
Sorry for the delay in a response!
This code should either work out of the box or atleast get you rolling!
<?php
//Make sure pagination works
global $query_string;
$args = wp_parse_args($query_string);
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$today = date('Ymd');
$old_args = array(
'post_type' => 'gigs',
'posts_per_page' => 10,
'paged' => $paged,
'meta_query' => array(
array(
'key' => 'event_start_date',
'value' => $today,
'compare' => '<',
'type' => 'date'
)
)
);
$old_gigs_query = new WP_Query($old_args);
$new_args = array(
'post_type' => 'gigs',
'posts_per_page' => 10,
'paged' => $paged,
'meta_query' => array(
array(
'key' => 'event_start_date',
'value' => $today,
'compare' => '>=',
'type' => 'date'
)
)
);
$new_gigs_query = new WP_Query($old_args);
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.
— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.