Support

Home Forums Event Espresso Premium Multiple calendars on one page

Multiple calendars on one page

Posted: July 17, 2013 at 10:43 am

Viewing 11 reply threads


Jonathan Ballou

July 17, 2013 at 10:43 am

I would like to add two calendars (each for a different categories). I need the calendars to be separated by text or/and the title of the category to be included in the calendar header.

Regardless of where on the page I add the short code for each calendar the two calendars become connected. All text seems to end up above or below the connected calendars.

http://www.aspensnowmasstraining.com/certification-training/level-2/

Is there a way to resolve this?


Josh

  • Support Staff

July 17, 2013 at 12:17 pm

Hi Jonathan,

The calendar wasn’t really intended to be displayed more than once a page, what ends up happening is it gets output into one html div. Which is why your text appears below the calendars.

This can be worked around with a bit of jQuery though.

You can wrap your text in a paragraph and give it a class so it can be selected easily by using some jQuery. On your calendar page in the editor it will look like this:

[ESPRESSO_CALENDAR]

<p class="between">Some text</p>

[ESPRESSO_CALENDAR]

Then you can use a plugin like Insert JavaScript and CSS (or add it to your own custom JavaScript file and load it onto the calendar page) to insert the following JavaScript to the calendar page:

jQuery(document).ready(function($) {
	$('.between').insertAfter('.fc-content:first');
});

What this will do is display the paragraph with the class “between” right after the first calendar.


Jonathan Ballou

July 17, 2013 at 1:02 pm

Thank you. I tries following these steps but am still having the same problem.


Josh

  • Support Staff

July 17, 2013 at 1:05 pm

Hi Jonathan,

I checked the calendar page that you linked to and the jQuery code I posted is no where to be found. Did you add the jQuery?


Jonathan Ballou

July 17, 2013 at 1:09 pm

I installed the recommended plugin and copied and pasted the jQuery in to the Insert JavaScript/CSS window. Is there something else that I should be doing?


Josh

  • Support Staff

July 17, 2013 at 1:43 pm

Might be the caching plugin you’re running. Since a caching plugin will serve cached versions of the page from before it was changed that could be why.

I can suggest an alternate way to inject the JS code to this page. You can add a function like this to the theme’s functions.php file or in /wp-content/uploads/espresso/custom_functions.php:

function mcop_custom_script() {
	if ( is_page(341) ) {
	?>
	<script type="text/javascript">
		jQuery(document).ready(function($) {
			$('.between').insertAfter('.fc-content:first');
		});
	</script>
	<?php
	}
}

add_action('wp_footer', 'mcop_custom_script');


Jonathan Ballou

July 17, 2013 at 1:45 pm

Thanks I’ll try that. Would it help to delete the cache or deactivate that plugin?


Josh

  • Support Staff

July 17, 2013 at 2:01 pm

If you make a change to the site, and it’s not showing up because of caching, deleting the cache will usually help.


Jonathan Ballou

July 17, 2013 at 2:46 pm

I have tried deleting the cache and deactivating the caching plugin and the problem still persists. I assume there is an issue with how I am entering the jQuery. I have followed the instructions for the plugin.


Josh

  • Support Staff

July 17, 2013 at 2:49 pm

I’d recommend going with the custom function posted here since the plugin is loading the script in the head of the document, which in this case will not work since the calendar scripts are loaded in the footer. I wasn’t aware that the Insert JavaScript plugin only loaded its scripts into the header. This will work for some things, but usually scripts should go in the footer.


Jonathan Ballou

July 17, 2013 at 2:51 pm

Got it. I’ll give that a try. thanks.


Josh

  • Support Staff

July 18, 2013 at 8:43 am

You’re welcome. Please let us know how that goes.

Viewing 11 reply threads

The support post ‘Multiple calendars on one page’ 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