Support » Plugin: My Calendar » upcoming shortcode no longer working correctly

  • Resolved infosws

    (@nicksws)


    Hi,

    No matter what we do, the shortcode is not displaying the correct number of events before/after today.
    Our shortcode is:

    [my_calendar_upcoming before=”1″ after=”20″ format=”list” type=”event” fallback=”No events coming up!” category=”Training Courses” template=”26f95b6b0b735726f31ea7bc35c88f5d” order=”asc” show_today=”yes” skip=”0″]

    But today (4th July) it shows 21 events in total but 9 before and 11 after.

    Even changing the type to “days” doesn’t fix it.

    Can you offer any help or explanation?

    Thanks.

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    Do you know when this problem started? Did it align to a particular release?

    Is your site using any caching? If so, what is the caching tool?

    Best,
    Joe

    Thread Starter infosws

    (@nicksws)

    Hi,

    We don’t know when this started. The customer reported it to us the other day.
    The website does use caching (Breeze, at the moment) although we don’t think that’s an issue. We’ve changed the shortcode variables several times in the last few days and the page content does update.

    Hope this helps.

    Plugin Author Joe Dolson

    (@joedolson)

    Is that an exact copy of the shortcode? It’s using a mix of straight quotes and smart quotes, which could be a problem; smart quotes will be perceived as text, rather than as delimiters.

    Thread Starter infosws

    (@nicksws)

    It could be a copy/paste issue into the forum. I’ve checked all the codes and replaced them all with standard ones (shift-2 on the keyboard).
    I’ve copied the shortcode again as text and as code into this message:

    [my_calendar_upcoming before=”1″ after=”20″ format=”list” type=”event” fallback=”No events coming up!” category=”Training Courses” template=”26f95b6b0b735726f31ea7bc35c88f5d” order=”asc” show_today=”yes” skip=”0″]

    [my_calendar_upcoming before="1" after="20" format="list" type="event" fallback="No events coming up!" category="Training Courses" template="26f95b6b0b735726f31ea7bc35c88f5d" order="asc" show_today="yes" skip="0"]

    Plugin Author Joe Dolson

    (@joedolson)

    Yeah, looks like posting it as text converts some of the quotes. Just odd that it only converts *some* of them.

    In my site, this seems to work as expected. Are you running the latest version of My Calendar?

    Thread Starter infosws

    (@nicksws)

    Hi,

    It is strange.

    Yes, we’re using the latest version of the plugin. 3.1.12.

    Thread Starter infosws

    (@nicksws)

    Hi,

    I further test, I removed the template attribute from the shortcode and it works.

    Not sure what could be wrong with the template though.

    Plugin Author Joe Dolson

    (@joedolson)

    Can you share your template?

    Thread Starter infosws

    (@nicksws)

    Here is the template code:

    <li id="list-{id}" class="mc-events">
    	<strong class="event-date">
    		<button type="button" class="mc-text-button" aria-expanded="false">
    			<i class="far fa-calendar"></i> {date} - {title}
    		</button>
    	</strong>
    	<div id="mc_list_{id}-list" class="mc-mc_list_{id} list-event mc_general past-event vevent mc_rel_general event-details" tabindex="-1" style="display: none;">
    		<span class="summary">
    			<span class="summary screen-reader-text">{description}</span>
    		</span>
    		<div id="mc_list_{id}-list-details" class="details no-image" role="alert" aria-labelledby="mc_{id}-title">
    			<div class="time-block">
    				<p>
    					<strong>Time:</strong> {time} - {endtime}<br />
    					<strong>Venue:</strong> <a href='{map_url}' target='_blank'>{location}</a>
    					<br /><br />
    				</p>
    			</div>
    			<strong>Details:</strong>
    			{description}
    		</div>
    		<!--end .details-->
    	</div>
    </li>

    Hope it helps.

    Plugin Author Joe Dolson

    (@joedolson)

    Tested with that template, and I didn’t get the wrong events with that template, either.

    I do note a problem in the resulting code using that template; you’re rendering the <li> element, which is already part of the list, so it’s rendered twice. You can use the ‘mc_event_upcoming_before’ and ‘mc_event_upcoming_after’ filters to remove the default list item element tags to fix that issue.

    However, I can’t see any reason this would cause extra events to appear. In general, I can’t see any reason that the template would impact the events presented *unless* the template itself included something that would pull additional events – and I don’t see any evidence of that.

    Plugin Author Joe Dolson

    (@joedolson)

    Are *all* of the events between 20 May and today’s date appearing in that list, or is it just some of them?

    If it’s just some of them, are there any common characteristics between those events that aren’t common with the events within that span that *aren’t* displayed?

    Thread Starter infosws

    (@nicksws)

    Hi,

    It doesn’t seem to be all the events so I dug further.
    I noticed, using a default layout (not a template) that the events with the issue had an end date on them which is still in the future, 2 months after the start date (the events don’t actually need an end date).

    I assume, because of this, the events are considered future events and showing on the list?
    I’ll update the events to remove the end date to double check but I’m sure that’s where the problem lays (with the data entered).

    Plugin Author Joe Dolson

    (@joedolson)

    Yes – if the end date is still in the future, then the events are considered currently happening, and will be represented in the upcoming events list.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘upcoming shortcode no longer working correctly’ is closed to new replies.