Hi,
Yes, you can do it by applying meta query with compare today and event start date.
if event start date is not equal to current date then it is expire.
Thanks
Hi,
How can I apply this meta query within page? Can you please give me an example?
Many thanks.
$today_date=date(“Y-m-d”);
$args = array(
‘post_type’ => ‘event_listing’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => $per_page,
‘paged’ => $paged
);
$args[‘meta_query’] = array(
array(
‘key’ => ‘_event_start_date’,
‘value’ => $today_date,
‘type’ => ‘date’,
‘compare’ => ‘<‘
)
);
$pastEvents = new WP_Query( $args );
-
This reply was modified 8 years, 12 months ago by
Ashok Dudhat.
-
This reply was modified 8 years, 12 months ago by
Ashok Dudhat.
Hi Ashok,
Many thanks for your reply. Can you please tell me will this make a short code of pastEvent that should I save in a page?
Hi,
It is not possible to put it in shortcode, so you have to do it separately,
Thanks