• Hi there, thanks for a great plugin!
    I run a site with all art exhibitions in my town. I have more than 50 events that run mostly over several months, with the result that on my month view basically the same 3 events show up all over the month. As you can imagine, this renders month view pretty useless:
    https://www.doartystuff.com/eventos/mes/?tribe-bar-date=2015-06-23
    I have tried to change the order of the events, but only managed to display those same 3 events in inverted order, since they get sorted after they have been retrieved.
    Where can I change the order of elements before they get retrieved, so that the latest events will display first (so one can see at least when a new event starts)?
    Thanks so much in advance for your help!
    (my plugin version is 3.10)

    https://www.ads-software.com/plugins/the-events-calendar/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Brook

    (@brook-tribe)

    Howdy mailme,

    That’s a cool idea. It’s easy to see why you are hitting a roadblock, that is not going to be an easy customization to make. There are two ways you could do it, directly modifying ‘/the-events-calendar/src/Tribe/Template/Month.php’, probably the get_daily_events() $arg variable is all you would need to modify. You could set it to preclude all day events, perhaps if the daily count is more than 3.

    The second way would be a bit of a hack, but it would not involve directly modifying the plugin so you could still update. You could create theme override for /month/loop-grid.php, and override the $daydata variable. You could create your own version of Tribe__Events__Template__Month::get_daily_events() and populate the $daydata with its variable instead.

    I hope one of those options works. Cheers!
    – Brook

    Thread Starter mailme.eva

    (@mailmeeva)

    Hi Brook!
    thanks a lot for taking the time to answer.
    I am not sure if I correctly interpreted your suggestions. I added

    'order'  => 'DESC',

    to the $args in get_daily_events(), but it also only sorts the retrieved 3 events in reverse order. I am not sure about what you meant with “preclude all day events”. I think that’s probably exactly what I need to do.

    I was also considering your second suggestion, but I am struggeling to understand how $daydata gets populated. It seems that after a chain of various other functions it ends up calling get_daily_events() all the same.

    Is there a way to set the order for the query before the posts_per_page_limit gets applied?

    I don’t really know any PHP, although I am used to editing templates with PHP logic, so please forgive me if I’m reading the PHP classes all wrong.

    Thanks a lot for your help!
    Eva

    Plugin Author Brian

    (@brianjessee)

    Hi Eva,

    There is not much else we can provide on this customization as it can get very technical and would require good php knowledge to really dig into.

    However, to modify a query earlier you can use the WordPress hook:

    pre_get_posts

    https://codex.www.ads-software.com/Plugin_API/Action_Reference/pre_get_posts

    and we have our own hook as well called:

    tribe_events_pre_get_posts

    Those are found in this file:

    the-events-calendar\src\Tribe\Query.php

    That might help you get some more insight, but beyond this we do not really have much else.

    Good Luck!

    Thread Starter mailme.eva

    (@mailmeeva)

    Ok, thanks for taking your time to answer, I understand.
    NEvertheless I really think that this should be configurable. You wouldnt want a useless month view for a very common event format.

    Thread Starter mailme.eva

    (@mailmeeva)

    Ok, thanks for taking your time to answer, I understand.
    Nevertheless I really think that this should be configurable. You wouldnt want a useless month view for a very common event format.

    Brook

    (@brook-tribe)

    Howdy again Mailme,

    I agree that it is a great feature request. I have not seen setups like yours very often, but on occassion they do crop up. And we like to support everyone as best we can.

    Please officially suggest this as a feature so that other people can see and voice their support for it: The Events Calendar: Suggest a feature

    Cheers!
    – Brook

    Thread Starter mailme.eva

    (@mailmeeva)

    Just in case someone else has the same need:
    If you use Version 3.10.1, you can change the general order of the wp-query in the file src/Tribe/Query.php on line 764:

    ORDER BY menu_order DESC, DATE(tribe_event_start.meta_value) DESC, TIME(tribe_event_start.meta_value) DESC;",

    Hope it helps!

    Thanks for posting this Eva!

    If you get a chance, could you mark this thread “Resolved” just to help keep things organized for us on the support team? It seems trivial but means more than you’d think ??

    Cheers!
    George

    Thread Starter mailme.eva

    (@mailmeeva)

    Resolved

    Barry

    (@barryhughes-1)

    Appreciated ??

    Thread Starter mailme.eva

    (@mailmeeva)

    Hi there I am reopening this ticket because I am bumping into problems once again when updating from 4.1.0.1 to 4.1.4.

    I had achieved a “latest first” order for the events shown in each day of the month view first by modifying the query as stated above (this query is part of the now deprecated function getEventCounts()). And lately I could just modify the default order where it is set in getEvents() to achive the desired results.

    Aparently in the latest version neither of those works. Can you point me to where to look for this change?

    Thank you very much.

    Thread Starter mailme.eva

    (@mailmeeva)

    Hi there, just giving this a bump…

    Brook

    (@brook-tribe)

    Howdy Mailme,

    I wish I could be of more help here. To be honest I am not sure either off the top of my head. Our queries get pretty complicated.

    To be completely upfront: this particular area is our volunteer forum, but all of us helping are paid staff. As a thank you to the community our managers have instructed us to man these forums and help with customizations when we can answer them off the top of our head. But they well know that researching stuff like this can take a lot of our time and cost the plugin money, so anything more than that is out of scope of what we can help with.

    Best of luck with this endeavor. I will leave this unresolved in case another community member wishes to collaborate on this or something. But as far as Modern Tribe goes we’ve helped as much as we can in this forum.

    Cheers!
    – Brook

    Thread Starter mailme.eva

    (@mailmeeva)

    Ok, thanks Brook

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Events shown on month view are all the same’ is closed to new replies.