• Resolved vergiis

    (@vergiis)


    Hello,

    I am using a calendar widget and when I create an event, there is a date highlighted and when I click on the date, it says an error: “Sorry… Sorry, no events match your search.”

    Any suggestion what is wrong? I would like to go on the actual event when I click on the date.

    Thank you.

    Veronika

Viewing 3 replies - 1 through 3 (of 3 total)
  • To make this work, I changed the line 668 in service/class-em-event.php to:

    $filter_results[]= $event_dao->get_events_at_date($start_date,true);

    And I have added this method to dao/class-em-event.php:

        // Get events at a date
        public function get_events_at_date($date, $format = false) {
            
            $start_time = em_time($date);
            $end_time = $start_time + 86340;
            
            $event_ids = array();
            $filter = array(
                'orderby' => 'date',
                 'numberposts'=> -1,
                'post_status'=> 'publish',
                'order' => 'DESC',
                'meta_query' => array(// WordPress has all the results, now, return only the events after today's date
                   'relation' => 'AND', 
                    array(
                        'key' => em_append_meta_key('start_date'), // Check the start date field
                        'value' => $start_time, // Set today's date (note the similar format)
                        'compare' => '>=', // Return the ones greater than today's date
                        'type' => 'NUMERIC,' // Let WordPress know we're working with numbers
                    ),
                    array(
                        'key' => em_append_meta_key('start_date'), // Check the start date field
                        'value' => $end_time, // Set today's date (note the similar format)
                        'compare' => '<=', // Return the ones greater than today's date
                        'type' => 'NUMERIC,' // Let WordPress know we're working with numbers
                    )
                ),
                'post_type' => EM_EVENT_POST_TYPE);
    
            $events = $this->get_events($filter);
            
            if (!empty($events)):
                foreach ($events as $event):
                    $event_ids[] = $event->ID;
                endforeach;
            endif;
            
            $recurring_events= $this->get_recurring_events_by_date($date);
            $event_ids= array_merge($event_ids,$recurring_events->ids);
          
            return $event_ids;
        }
    • This reply was modified 7 years, 5 months ago by Kasp.
    Thread Starter vergiis

    (@vergiis)

    Thank you, it works!

    Plugin Author kikfyre

    (@kikfyre)

    Thank you. We will be including the fix in our upcoming release 2.1.4.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Calendar Widget’ is closed to new replies.