Support

Home Forums Events Calendar Add-on Events Calendar works on some pages, but not all

Events Calendar works on some pages, but not all

Posted: June 27, 2018 at 7:52 am

Viewing 10 reply threads


3thought

June 27, 2018 at 7:52 am

The Events calendar add-on works on some pages, but not on all of them If you go to http://staging2.childrensmuseumineaston.org/, you can see it is not loading the calendar, but it will load properly on this page http://staging2.childrensmuseumineaston.org/57657-bb-test-ee-calendar/. Does anyone know what might cause this? The site is using Beaver Builder. Thanks for the help.

EE Version 4.9.64.p
EE Calendar Version 3.2.12.p
WP Version 4.9.6


Josh

  • Support Staff

June 27, 2018 at 1:29 pm

Hi,

I can’t see any of the pages you’ve linked to because of .htpassword.

What usually causes the calendar issue is when the [ESPRESSO_CALENDAR] shortcode is used outside of the main content of a WordPress page or post, then it’s not tracked. The idea behind the shortcode/page tracking was to load the calendar JS and CSS only on the pages where needed. The problem with the implementation though is it’s not reliable to check only in the main content.

To work around this, you can add some code into a functions.php file (or plugin) that will make it so the calendar scripts load:

https://gist.github.com/joshfeck/5d9c88fea504c0b111c3df8f24ad25d9

In the above example, it’s checking for the “Calendar” page with:
is_page( 'calendar' )
and that part can be changed to check for the home page instead:
is_home()
or depending on how the site’s “Front page displays” Reading setting is set:
is_front_page()


3thought

June 28, 2018 at 11:26 am

Hi Josh,

I tried adding that function and it did not resolve the issue. I have removed the password so you should be able to access those pages now. Thanks for the help.


Josh

  • Support Staff

June 28, 2018 at 12:46 pm

Adding the function alone will not resolve it because the function WOULD need to be modified to check for the home page.

Alternatively, since the page was edited with Beaver Builder, following these steps might help:
1) View the page on the front end (not in Beaver Builder editor mode, just viewing the page while logged in as an admin)
2) Click the Edit Page link in the WP toolbar
3) Click the Update button


3thought

June 28, 2018 at 1:03 pm

Hi Josh,

I did modify the function, when I added it. I also tried the steps that you suggested above and that did not resolve the issue. Thanks.


Josh

  • Support Staff

June 28, 2018 at 1:06 pm

May I ask can you post the entirety of the modified code that was added to the site into a pastbin or GitHub gist so we can review?


3thought

June 28, 2018 at 1:13 pm

Here is a link to the gist https://gist.github.com/richsalvucci/70a73b5463002a757bfc52af2f74f172


Josh

  • Support Staff

June 28, 2018 at 1:30 pm

Ok this line:
if ( class_exists( 'EED_Espresso_Calendar' ) && is_home() ) {
needs to be changed to:
if ( class_exists( 'EED_Espresso_Calendar' ) && is_front_page() ) {
because the site is using a static page for the home page.


3thought

July 3, 2018 at 12:09 pm

Hi Josh,

Sorry it has taken a while to get back to you. I made the change in my code to is_front_page() and it is still not rendering as expected on the home page. Is there anything else I can do?

Thanks!


Josh

  • Support Staff

July 3, 2018 at 12:20 pm

Can you verify that the code is actually loading and executing? For example was the code placed within a plugin file below a plugin header, and the plugin is activated?


3thought

July 3, 2018 at 12:37 pm

Hey Josh,

I created a plugin to add the code that way and activated it. It is displaying properly now. Thank you so much for the help.

Viewing 10 reply threads

The support post ‘Events Calendar works on some pages, but not all’ 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.

Event Espresso