Forums

Events Calendar 3 - Remove Events from Loop When They Have Finished? (1 post)

  1. johnantonygallagher
    Member
    Posted 1 year ago #

    Hi,

    I'm currently working on an events section for a site using Events Calendar 3. I'm using a custom loop to display the list of events.
    I'm looking for a way to remove events from the loop once they have finished. So far, the best I can come up with is comparing the event end date with the current date, and using the result to determine whether the event is displayed in the loop or not.
    I'm trying the following to get the end date:

    $id = get_the_ID();
    $expires = $wpdb->get_var($wpdb->prepare("SELECT end FROM wp_ec3_schedule WHERE post_id EQUALS '$id'"));

    However, when I try to echo the result, it's not returning anything.
    Does anyone have any idea where I'm going wrong here? I'm sure that once I get the end date stored in a variable, I'll be able to modify my loop to only display events that have not yet ended.

    Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by johnantonygallagher
  • This topic is not resolved
  • WordPress version: 3.1.1