Recurring events shown after non-recurring events.

Home Forums Calendar Products Events Calendar PRO Recurring events shown after non-recurring events.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1140429
    Emilie
    Participant

    Hi,
    I’m a developper new to wordpress. I have a request from my client who wants to shown the non-recurring events before the recurring ones. This must be visible on those views (month, days, list).

    I have no problem creating the algorithm but I don’t know where to code it to respect wordpress good practice. Could you pin point me the file/method to edit/create.

    I also understand that I must create a filter.

    I’m inspiring myself from this thread but I dont quite understand this sentence where all the magic happens: «tribe_get_events() via filter and sort the returned results based TribeEvents::current_view.»

    What is this filter? And where does it live?

    Thanks a lot.
    Hugues McNeil-Duval

    #1141030
    Nico
    Member

    Hi there Hugues,

    Thanks for getting in touch! I can help you here…

    Please take a look to this previous answer by Cliff in which he shares two snippets to re-order recurring and all-day events. These snippets go inside your theme (or child theme).

    What is this filter? And where does it live?

    to get a grasp on filters and actions, I recommend reading the Definitive guide to WordPress hooks.

    Please let me know if the above helps,
    Best,
    Nico

    #1141708
    Emilie
    Participant

    Hi,

    Ok the above snippets describe in the other post did help me. They do the filter all right except when we get over 3 events per day.

    I’ve created 3 events : “nr_ad – not-recurrent_all-day”, “nr – not-recurrent (not all day)”, “rd_ad – recurrent-day_all-day”

    So when I apply the filter (first snippet by Cliff), the events of a day cell in the month view are in this order :
    nr_ad – not-recurrent_all-day
    nr – not-recurrent (not all day)
    rd_ad – recurrent-day_all-day

    Which is what we want.

    But then I add a fourth event, (rw_ad – recurrent-week_all-day), the order becomes :
    nr_ad – not-recurrent_all-day
    rd_ad – recurrent-day_all-day
    rw_ad – recurrent-week_all-day
    View All 4 Events »

    Which is not what we want because not_recurrent must come first. I should see “nr” event.

    I assume that the list sent to “tribe_events_get_current_month_day” is length 3 maximum and all_day events have predominance over not_all_day. Should I apply a function on an other filter so that I send to “tribe_events_get_current_month_day” an already filtered list ? If so can you tell the name of the filter?

    Thanks!

    Hugues

    #1142941
    Nico
    Member

    Hi there Hugues,

    Sorry for the delay in my reply! You seem to be right events are first fetched by get_daily_events with the events_per_day limit. The expected order of events is: sticky events, ongoing multi day events, all day events, then by start time. You can modify that query arguments by using the tribe_events_month_daily_events_query_args filter. You cna start by dumping the arguments like these:


    /* Dump month daily events query */
    add_filter ('tribe_events_month_daily_events_query_args', function ( $args ) {
    echo '

    ';
    	var_dump($args);
    	echo '

    ';
    return $args;
    });

    The idea is to modify the query args before returning it, in the code sample above the query arguments are just dumped in the page so you can inspect them.

    Please let me know if you can get it working from there,
    Best,
    Nico

    #1151306
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Recurring events shown after non-recurring events.’ is closed to new replies.