WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Event List without expired Events (3 posts)

  1. beatcasino
    Member
    Posted 2 years ago #

    The Event list shows all current and future events. That's Ok.
    But a current event for me is time dependent.

    Example:
    Event A from 24.05. 05am - 25.05. 4pm <- When the Event list is generated on the 25.05. at 5pm, the Event is still listed although it is already expired.

    Is there a possibility to configure that in the anywhere? I didn't found a solution jet.

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    you can create a new search attribute using this tutorials - http://wp-events-plugin.com/tutorials/creating-custom-event-search-attributes/

    also, additional snippet which can give you an idea

    add_filter( 'em_events_build_sql_conditions', 'my_em_scope_conditions',1,2);
    function my_em_scope_conditions($conditions, $args){
    	if( !empty($args['scope']) && $args['scope'] == 'this-week' ){
    		$start_date = date("Y-m-d", strtotime(date("Y").'W'.date('W')."1"));
    		$end_date = date("Y-m-d", strtotime(date("Y").'W'.date('W')."7"));
    		$conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))";
    	}
    	return $conditions;
    }

    you can add this to your theme functions.php

  3. nwlforummod
    Member
    Plugin Author

    Posted 2 years ago #

    am going to marked this as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic