Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ashok Dudhat

    (@ashokdudhat)

    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

    Thread Starter atharalikhichi

    (@atharalikhichi)

    Hi,

    How can I apply this meta query within page? Can you please give me an example?

    Many thanks.

    Plugin Author Ashok Dudhat

    (@ashokdudhat)

    $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 7 years, 6 months ago by Ashok Dudhat.
    • This reply was modified 7 years, 6 months ago by Ashok Dudhat.
    Thread Starter atharalikhichi

    (@atharalikhichi)

    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?

    Plugin Author Ashok Dudhat

    (@ashokdudhat)

    Hi,

    It is not possible to put it in shortcode, so you have to do it separately,

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Expired Events’ is closed to new replies.