Home › Forums › Calendar Products › Events Calendar PRO › Multiple Day Event Formatting
- This topic has 10 replies, 3 voices, and was last updated 9 years, 9 months ago by
Brook.
-
AuthorPosts
-
August 1, 2016 at 2:19 pm #1146271
Emily Pryor
ParticipantIs there any way to make the formatting for a multiple day event be “greyed” back when it’s not the first day?
I’ve been able to do it via a jQuery each function but that only works when there’s just one event a day, with mulitple events a day some recurring multiple days, the loop gets too complex.
Ideally it would be something like setting the link color to be different when it’s not the first day of a multiple day event.
Thanks!
August 1, 2016 at 8:53 pm #1146385Brook
ParticipantHowdy Emily,
I would love to help you with this. Are you trying to do this on List View for events that span multiple days? Basically you just want a different CSS class attached to the event when it is a followup day?
If we’re on the same page let me know and I’ll research the best way for what you specifically need. If you need something a little different, I’ll look into that instead.
Cheers!
– Brook
August 2, 2016 at 5:42 am #1146477Emily Pryor
ParticipantThis would be in the calendar view for events across multiple days, URLs below.
So yes, one class around the first instance (there’s a DIV/H3/A structure, it looks like it’d be in the outside DIV) and then a different class around all other instances would be perfect.
What I was trying to do was simulate that with jQuery each loops around the same HREFd A tags, and that works fine when there’s just one event a day, but doesn’t work when there’s multiple on a day the way it’s looping. See them nicely here in August, but not in September. (Which you might have to reload to get the jQuery to kick in.)
http://data2x.org/events/2016-09/
If you want to move this thread to just email, I’m actually Chad, the developer for Data2X and am at [email protected]. But it’d fine to keep things here as well if it needs to be.
Thanks!!
August 3, 2016 at 10:23 am #1147197Brook
ParticipantThanks for clarifying Chad. This should be easy enough to do with a WP filter. I just wrote up something you can insert into your functions.php which will add CSS classes to the month view events:
https://gist.github.com/elimn/310d67f65c2bebdfce2ca42146f6ebcb
The class you would want to target would be ‘tribe-month-multiday-start-date’. Style that with CSS and you should be golden.
Did that do you what you needed?
Cheers!
– Brook
August 3, 2016 at 10:47 am #1147214Emily Pryor
ParticipantThanks much, that should work perfectly, but this line has a PHP error:
$cur_day = tribe_events_get_current_month_day()[ ‘date’ ];
From your docs, looks like that returns an array, but that’s not the right syntax, at least it’s throwing an error on the []. So I tried this to pull the array then get the value:
$cur_day_array = tribe_events_get_current_month_day();
$cur_day = $cur_day_array[‘date’];And while that doesn’t throw an error, it’s not inserting the classes. I’m assuming this would be added to the DIV tag which surrounds the H3 and A, and I don’t see anything in there. Looking at the code, it all looks logical and correct to me, so not sure why it’s not working.
Thanks for your continued assistance!!
Chad
August 4, 2016 at 6:56 am #1147514Brook
ParticipantHowdy Chad,
Good call on that. It sounds like you’re on an older version of PHP so that line needed to be changed.
Have you disabled Month View Cache for now? If it’s enabled these changes won’t appear for a while. That setting can be found in WP-Admin > Events > Settings > Display . I forgot to mention needing to disable that. If that did not do the trick, do you have any other sorts of caches in place that might need to be cleared or disabled temporarily?
Cheers!
– Brook
August 4, 2016 at 7:06 am #1147518Emily Pryor
ParticipantThe cache wasn’t on, and nothing else that would affect anything in the functions.php file.
I changed the function to be only:
$classes[] = ‘testCHAD’;
return $classes;Which should put that class in every entry regardless (at least from how I’m reading things) and it’s not doing that. It seems like the function is running (since the errors triggered), but not actually hooking in to the calendar.
Thanks!
Chad
August 4, 2016 at 10:38 pm #1147967Brook
ParticipantThat is odd. I think I might have discovered why. It’s possible the priority of the hook is too soon.
I just updated the above snippet, would you mind trying the latest version? It should fix both of the errors you’ve experienced. Does it?
Cheers!
– Brook
August 5, 2016 at 10:15 am #1148290Emily Pryor
ParticipantAugust 7, 2016 at 9:26 pm #1148864Brook
ParticipantPerfect news! Thanks for getting back.
Let us know if you ever need anything else.
Cheers!
– Brook
-
AuthorPosts
- The topic ‘Multiple Day Event Formatting’ is closed to new replies.
