Posted: July 23, 2018 at 11:32 am
|
The event calendar is missing from our site both on our custom page and the default /events page. Seeing an error in the console but not sure what it’s from. wecm.ca/training-events/ |
Hi, May I ask, is the Calendar shortcode added to the page content within the native WordPress editor? or added via a 3rd page builder editor? or added directly in with a do_shortcode() function to the template? If the latter, you’ll need to follow this guide: https://eventespresso.com/wiki/events-calendar-add-on/#ee4customizations |
|
|
On the default /events page it’s just a short code. The other custome page I’m not sure. |
OK. In the page source, there’s a potential gotcha happening: https://slack-files.com/T02SY781D-FBVFR1Q82-563fe7954c Can you change the line: to be:
It looks like that’s something added from the theme. |
|
|
Changed that but still generating the same error. |
Yeah that was really bad advice on my part, debugging other people’s jQuery plugins is not exactly my wheelhouse. What happens if you remove the
entirely? Does the calendar display then? |
|
|
Then I get a new error also related to jquery |
|
I removed everything that was related in the header.php to those errors
Now the calendar works properly. |
|
Homepage is also showing some errors around jquery as well. |
Is the area of the home page where the calendar would display set up using a page builder style editor or is it using the native WordPress editor? With regards to those scripts, the way forward will be to use the wp_enqueue_script() function and load the scripts only where needed (and quite possibly set to load in the footer) instead of hardcoding them directly into header.php. |
|
|
Can you fix this with the support token service? I tried changing the jquery( to $( and then it just says $ is not a function |
May I ask fix what exactly? Do you mean fix the jQuery plugins that are throwing JS errors or fix the home page so it can display the calendar? |
|
|
Think I found the cause. I replaced the following AND
Replaced with: `jQuery(function ($) { AND
I just have this error on the homepage now but I’m not actually loading the calendar here. Uncaught ReferenceError: eeCAL is not defined |
Is the area of the home page where the calendar would display set up using a page builder style editor or is it using the native WordPress editor? |
|
|
That error is showing on all pages and I found this in the theme header.php.
Should that be replaced with https://gist.github.com/joshfeck/5d9c88fea504c0b111c3df8f24ad25d9 |
The above code should be removed from header.php. Then you add the code from the gist to the theme’s functions.php file (or into a plugin). Then change line 7 from the gist, to match your home page. Which might be this: or could be: |
|
|
Ok and if I wanted it to load those on both “events” and “training-events” is_page( array(‘events’,’training-events’)) |
I don’t think you need to force load the calendar scripts on the training-events page. is_page() does support an array though: https://developer.wordpress.org/reference/functions/is_page/#comment-1031 |
|
|
Those are the two pages that the calendars display on though |
The calendar is already displaying on |
|
|
Because those lines that I removed from the header were loading it on the training-events page. I removed those and added the code you said to the functions.php. If I remove it from functions then the calendar doesn’t load. Nor does it load on the /events page |
OK then. You’ll add whatever pages to your array, and if you’re also loading on a calendar on the home page, you can also include e.g.
|
|
|
Great! Thanks Josh! |
|
Almost, how do I target the default /events for EE4 as it doesn’t seem to work using the array. Is that because that page is considered an archive post type and not an actual page? |
That’s right, it’s not a page if it’s a post type archive. You can add to your conditional statement:
and you’ll need to account for operator precedence, so:
|
|
|
Great, thanks again! |
The support post ‘Event Calendar Missing’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.