Home › Forums › Calendar Products › Events Calendar PRO › Recurring events shown after non-recurring events.
- This topic has 5 replies, 4 voices, and was last updated 9 years, 8 months ago by
Emilie.
-
AuthorPosts
-
July 15, 2016 at 10:16 am #1140429
Emilie
ParticipantHi,
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-DuvalJuly 18, 2016 at 7:55 am #1141030Nico
MemberHi 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,
NicoJuly 19, 2016 at 3:12 pm #1141708Emilie
ParticipantHi,
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-dayWhich 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
July 22, 2016 at 8:47 am #1142941Nico
MemberHi 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,
NicoAugust 13, 2016 at 9:35 am #1151306Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘Recurring events shown after non-recurring events.’ is closed to new replies.
