Home › Forums › Calendar Products › Events Calendar PRO › Help with Mini Calendar
- This topic has 10 replies, 2 voices, and was last updated 8 years, 6 months ago by
Iris Suarez.
-
AuthorPosts
-
October 9, 2017 at 11:41 am #1361198
Iris Suarez
ParticipantHi, we had our Mini Calendar showing a clickable link if there was an event on a particular day. It was linking to the calendar page day display, and was working. Recently it stopped working a few weeks ago. We have disabled any plugins that were added with no change. I am attaching our function in the email which is not finding events and returning the “no-events” span markup.
Can you please help us figure out why the query is not finding the events any longer?
Do note, we DO have the event list that gets displayed below the mini calendar working (it does find the events). Our client has asked us to display:none the list, but it is in the code on the sidebar of every page below the mini calendar, so we do have events.
Thanks you for any help u can provide.
October 11, 2017 at 9:32 am #1362091Barry
MemberHi Iris,
I’d be happy to take a look but please bear in mind the degree of support we can offer for any custom code you have does tend to be limited (it may also take us a little longer to help with this sort of request).
Can you share your code via Pastebin, Gist or some other comparable service? Otherwise we’d have to manually rewrite it from your screenshot.
Thanks!
October 11, 2017 at 10:26 am #1362177Iris Suarez
ParticipantSure, here is a pastebin of the function:
Please let me know if there is any other info you need to help, thanks!
October 11, 2017 at 3:58 pm #1362280Barry
MemberHi Iris,
The only difference I see between your custom version and the default version of that function is on the following line:
$html = '<a href="#">' . $day['daynum'] . '</a>'
Note the -NEW section in the class attribute — that’s something you’ve added and I’m not sure what to say except our Javascript doesn’t expect this and won’t work with it.
As a further note, I’m not completely sure how you are implementing this change but I felt it was worth highlighting that if you are overwriting the core function directly, this is not a great idea and will mean you need to continually revisit and update it with each new version of The Events Calendar.
October 11, 2017 at 5:46 pm #1362339Iris Suarez
ParticipantHi Barry, can you tell me why the change in the link class change would impact the javascript?
ie, why would
class=”tribe-mini-calendar-day-link”
be ok and
class=”tribe-mini-calendar-day-link-NEW”
cause an issue with the JS?it doesn’t seem that it is even getting to that line in the function, but instead, failing the conditional
if ( $day[‘total_events’] > 0 )and outputting the span tag with the no events class in it.
I’m not sure why I changed the class, I will look into it, and it was probably just so I knew the file I was updating was actually the one in use, and I just left it there.
How would you recommend I overwrite the function without modding the core plugin. Can I add the function to functions.php in the theme being used?
Thanks!
-
This reply was modified 8 years, 7 months ago by
Iris Suarez.
-
This reply was modified 8 years, 7 months ago by
Iris Suarez.
October 12, 2017 at 1:58 pm #1362899Barry
MemberHi!
Hi Barry, can you tell me why the change in the link class change would impact the javascript?
Sure: the class is what the widget uses to identify those particular links. By altering the class name, it is no longer able to find them and work with them.
How would you recommend I overwrite the function without modding the core plugin. Can I add the function to functions.php in the theme being used?
We provide hooks for this sort of thing. In this case, there is a filter named:
tribe_events_the_mini_calendar_day_link
You can use that to safely override the HTML produced by this function with code like this (simplified example just to illustrate how it works):
add_filter( 'tribe_events_the_mini_calendar_day_link', function() { return '<a href="#">Custom HTML for day view links</a>'; } );This is safer and is the recommended way to make this sort of change 🙂
October 12, 2017 at 2:08 pm #1362905Iris Suarez
ParticipantThanks. Do you know why the conditional check for:
if ( $day[‘total_events’] > 0 )
is going right to the else statement (returning the <span class=”tribe-mini-calendar-no-event”>)?
I changed the class on the link back to class=”tribe-mini-calendar-day-link”, but it didn’t have an effect.
if ( $day['total_events'] > 0 ) { // there are events on this day if ( $args['count'] > 0 ) { // there is an event list under the calendar $html = '<a href="#" data-day="' . $day['date'] . '" class="tribe-mini-calendar-day-link">' . $day['daynum'] . '</a>'; } else { // there are no events under the calendar if ( tribe_events_is_view_enabled( 'day' ) ) { // day view is enabled ob_start(); tribe_the_day_link( $day['date'], $day['daynum'] ); $html = ob_get_clean(); } else { // day view is disabled, just show that there are events on the day but don't link anywhere $html = '<a href="javascript:void(0)">' . $day['daynum'] . '</a>'; } } }October 12, 2017 at 5:15 pm #1362986Iris Suarez
Participantactually, i put back the original widgets.php file inside src/functions/template-tags, and if you look here:
https://cupertinotoday.com/every day in the mini calendar is still failing that conditional and returning the:
$html = ‘<span class=”tribe-mini-calendar-no-event”>’ . $day[‘daynum’] . ‘</span>’;
this is specifically what I believe our problem is. we have plenty of events:
http://cupertinotoday.com/?post_type=tribe_events or you can check the hidden list below the mini calendar (client request to hide).Is it possible for you to help us figure out why:
if ( $day[‘total_events’] > 0 )is returning false?
Thanks!
October 16, 2017 at 4:12 pm #1364362Barry
MemberThat’s definitely odd. Unmodified, there should be no problem. Perhaps there’s a conflict with your theme or with another plugin.
theeventscalendar.com/knowledgebase/testing-for-conflicts
Would you be able to run through the above troubleshooting steps, either on your production site or from within a testing/staging environment if you have one available?
November 7, 2017 at 8:35 am #1377027Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
This reply was modified 8 years, 7 months ago by
-
AuthorPosts
- The topic ‘Help with Mini Calendar’ is closed to new replies.
