WordPress.org

Ready to get started?Download WordPress

Forums

Ajax Event Calendar
[eventlist] sorting to show events sorted by date (4 posts)

  1. adamalzoubi
    Member
    Posted 1 year ago #

    Hello,
    1st i would like to thank you for a such a great plugin. I have a question on the short code [eventlist] which works great but it makes more sense to show the events starting with the newest ones first based on date.

    please let me know how to do that.

    Thank you for your time.
    adam

    http://wordpress.org/extend/plugins/ajax-event-calendar/

  2. peteboucher
    Member
    Posted 1 year ago #

    I'm having a similar issue, the eventlist is sorting by category first, then date.
    E.g. using shortcode:
    [eventlist limit=6 categories="1,3,4"]

    only shows the first 6 events from category 1 even though the other categories (3 and 4) have events scheduled on dates preceding the second category 1 evenr displayed in the list.

    I'd suggest changing the MySQL ORDER BY clause in the SELECT statement for event list to:
    ORDER BY wp_aec_event.start DESC, wp_aec_event.category_id

  3. peteboucher
    Member
    Posted 1 year ago #

    Having looked a the code the SQL appears correct:

    $result = $wpdb->get_results("SELECT
      id,
      user_id,
      title,
      start,
      end,
      allDay,
      repeat_int,
      repeat_freq,
      repeat_end,
      category_id
      FROM " . $wpdb->prefix . AEC_EVENT_TABLE . "
      WHERE (
      (start >= '{$start}' AND start < '{$end}')
      OR (end >= '{$start}' AND end < '{$end}')
      OR (start <= '{$start}' AND end >= '{$end}')
      OR (start < '{$end}' AND (repeat_freq > 0 AND repeat_end >= '{$start}'))
      )
      {$andcategory} ORDER BY start{$limit};");

    assuming the shortcode in question is using the function db_query_events(), and I'm not sure how to test this assumption on my site.

    Any ideas would be much appreciated.

  4. fairmarketing
    Member
    Posted 1 year ago #

    Same here: I simply cannot find a possibility to sort the event starting with the newest date...
    any help on this would be deeply appreciated :)

    anyway: the plugin itself is very easy to install and to use

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags