Help with Mini Calendar

Home Forums Calendar Products Events Calendar PRO Help with Mini Calendar

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1361198
    Iris Suarez
    Participant

    Hi, 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.

    #1362091
    Barry
    Member

    Hi 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!

    #1362177
    Iris Suarez
    Participant

    Sure, here is a pastebin of the function:

    https://pastebin.com/DT0CjX4b

    Please let me know if there is any other info you need to help, thanks!

    #1362280
    Barry
    Member

    Hi 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.

    #1362339
    Iris Suarez
    Participant

    Hi 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.
    #1362899
    Barry
    Member

    Hi!

    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 🙂

    #1362905
    Iris Suarez
    Participant

    Thanks. 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>';
    			}
    		}
    	}
    #1362986
    Iris Suarez
    Participant

    actually, 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!

    #1364362
    Barry
    Member

    That’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?

    #1377027
    Support Droid
    Keymaster

    Hey 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

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Help with Mini Calendar’ is closed to new replies.