Support

Home Forums Event Espresso Premium do_shortcode Event calendar

do_shortcode Event calendar

Posted: January 13, 2016 at 3:27 am


Talmor

January 13, 2016 at 3:27 am

Hello,
How do i call the event calendar in a theme template? The do_shortcode will not load the calendar. I really need to call the calendar outside a post content.
Thanksyou


Lorenzo Orlando Caum

  • Support Staff

January 13, 2016 at 7:40 am

Hi Talmor,

Please see the example at the end of this page:

https://eventespresso.com/wiki/events-calendar-add-on/#ee4customizations

Thanks


Lorenzo


Talmor

January 14, 2016 at 2:34 am

Hi Lorenzo,
I did paste the global and the filter but with no success.
The CSS files will not load.

<?php  
global $is_espresso_calendar;
$is_espresso_calendar = TRUE;
add_action('wp_enqueue_scripts', array('EED_Espresso_Calendar', 'calendar_scripts'));
add_filter('FHEE_load_qtip', '__return_true' );
echo do_shortcode('[ESPRESSO_CALENDAR show_expired=false]');
?>


Lorenzo Orlando Caum

  • Support Staff

January 14, 2016 at 8:53 am

Hi Talmor,

Adding the following before your do_shortcode should load the correct files:

wp_enqueue_style(‘fullcalendar’);
wp_enqueue_style(‘espresso_calendar’);


Lorenzo


Talmor

January 15, 2016 at 5:31 am

Lorenzo still no success.
Please give me the complete code for calling the calendar.
What i now use doesnt work.

global $is_espresso_calendar;
$is_espresso_calendar = TRUE;
wp_enqueue_style('fullcalendar');						wp_enqueue_style('espresso_calendar');						add_action('wp_enqueue_scripts', array('EED_Espresso_Calendar', 'calendar_scripts'));								add_filter('FHEE_load_qtip', '__return_true' );
echo do_shortcode('[ESPRESSO_CALENDAR]'); 


Tony

  • Support Staff

January 15, 2016 at 6:20 am

If you load the page with Chrome Dev Tools open, do you see any errors within Console?


Talmor

January 19, 2016 at 3:36 am

No don’t get errors. It seems impossible to load the calendar without using the shortcode in the content. Tried several things. The only way to load the calendar is using the shortcode in the content AND call with the do_shortcode in the template for a specific place on the page. Not ideal


Josh

  • Support Staff

January 19, 2016 at 8:45 am

Hi there,

May I ask which theme you’re using, which template you are adding the code to, and where in the template you added the code? If you can post the contents of the template file in a pastebin or gist, then like here, we can take a closer look.


Talmor

January 26, 2016 at 4:59 am

Hi Josh,
It’s the cyberchips responsive mobile theme with some custom code.

But i’ve tried the same code in the latest twentyfourteen theme with only the event espresso plugins active and still nothing happens.

Tried it in and outside of the loop and updated the event plugin.


Tony

  • Support Staff

January 26, 2016 at 5:06 am

Looking at your code it looks like your running the above as one single block, is that correct?

The reason I ask is the calls to force the calendar scripts to load on the page must be before the call to wp_head() or get_header() within your template file.

So above whichever of those calls you are using within the template you can do:

if ( class_exists( 'EED_Espresso_Calendar' ) ) {
	global $is_espresso_calendar;
	$is_espresso_calendar = TRUE;
	add_action( 'wp_enqueue_scripts', array( EED_Espresso_Calendar::instance(), 'calendar_scripts' ) );
	if ( EED_Espresso_Calendar::instance()->config()->tooltip->show ) {
		add_filter('FHEE_load_qtip', '__return_true' );
	}
}

Then you use echo do_shortcode('[ESPRESSO_CALENDAR show_expired=false]'); within the template to output the calendar.

We have updated the calendar documentation to make this clearer here:

https://eventespresso.com/wiki/events-calendar-add-on/#ee4customizations

The support post ‘do_shortcode Event calendar’ 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