Home › Forums › General Issues › Only show posts if the date picker date is still in the future or today › Reply To: Only show posts if the date picker date is still in the future or today
Got this working like this:
<?
$currentdate = date("Y-m-d",mktime(0,0,0,date("m"),date("d")-1,date("Y")));
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} else if ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
query_posts( array(
'meta_query'=> array(
array(
'key' => 'event_date',
'compare' => '>',
'value' => $currentdate,
'type' => 'DATE',
)),
'post_type' => 'events',
'meta_key' => 'event_date',
'orderby' => 'meta_value_num',
'posts_per_page' => 4,
'order' => 'ASC',
'paged' => $paged ) );
while (have_posts()) : the_post();
?>
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 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.