Support

Home Forums Event Espresso Premium [ESPRESSO_CALENDAR] Shortcode within a text widget?

[ESPRESSO_CALENDAR] Shortcode within a text widget?

Posted: October 15, 2015 at 8:29 pm


denise

October 15, 2015 at 8:29 pm

Hi,

Is there any limitation for using the [ESPRESSO_CALENDAR] shortcode within a widgetized page? I setup my theme to use a widgetize page and the shortcode would not get activatd it just displayed the raw text ” [ESPRESSO_CALENDAR]”.

I contacted my theme admin and they said to try the following:
-add the Shortcodes Ultimate plugin: nothing is being displayed now.
-the theme admin tried it with the free version of EE and used [ESPRESSO_EVENTS] code and it worked for her.
-they recommended I try setting this CSS:.textwidget {margin: 0 auto; max-width: 1000px;} The result is still nothing

Can you please let me know what I might be doing wrong?

This is my Website Link for your reference:
http://miyceramics.com/class-calendar-widget/


Josh

  • Support Staff

October 16, 2015 at 7:51 am

Hi Denise,

Would it work for you to use the Espresso Calendar widget in the widgetized area instead of a shortcode in a text widget?


denise

October 16, 2015 at 11:27 am

Hi Josh,

That would work find, but I tried that and still nothing is getting displayed:

http://miyceramics.com/class-calendar-widget/


Josh

  • Support Staff

October 16, 2015 at 12:19 pm

Hi Denise,

I checked the source of the page and what’s interesting is there are scripts for a full-calendar-js WordPress plugin. The Event Espresso Calendar add-on uses the same scripts (although a different version). There might be a plugin conflict here. Can you go to the WP plugins page and try deactivating the other calendar plugin, and make sure that the only calendar plugin active on the site is the Event Espresso Calendar add-on? It’d also be good to verify that you have the EE4 version of the calendar add-on as well.


denise

October 16, 2015 at 12:44 pm

HI Josh,

I removed the full calendar plugin that was there, and I am using Version 3.2.6.p of the ee4 plugin. Still not working.

Thanks
Denise


Josh

  • Support Staff

October 16, 2015 at 1:59 pm

Hi Denise,

Can you outline how you’ve set up the page to use widgets so we can investigate?


denise

October 19, 2015 at 12:51 pm

Hi Josh,

On my Dashboard I have created a CALENDARW page to test this out:
http://miyceramics.com/class-calendar-widget/

I set it up to be a widgetized page:
PAGE->Edit->Page Attributes->template set to WIDGETIZED PAGE.

I then add the options to how that page should be displayed:
DASHBOARD->APPEARANCE->WIDGETS

I have 4 options on how I want to the page to be displayed you can check out the latest configuration on this screen shot:
http://miyceramics.com/blog/wp-content/uploads/2015/10/Screenshot.jpg

Here is a screenshot of the calendar widget settings:
http://miyceramics.com/blog/wp-content/uploads/2015/10/screenshot2.jpg

Please let me know if that is sufficient or if you need anything else.

Thanks for your support!


Josh

  • Support Staff

October 19, 2015 at 3:00 pm

Hi Denise,

Those steps should work to display the calendar widget, at least they do when I try the same steps using the Woo Canvas there.

Here’s a few other options you have to display a calendar on this page. First, you’ll need to make sure that the calendar’s scripts are ready to load on the page, so you add this to a to a functions plugin or into your WordPress theme’s functions.php file:

function add_calendar_to_pages() {
  if ( class_exists( 'EED_Espresso_Calendar' ) && is_page( 'class-calendar-widgets' ) ) :

    global $is_espresso_calendar;
    $is_espresso_calendar = TRUE;
    if ( ! has_action( 'wp_enqueue_scripts', array( EED_Espresso_Calendar::instance(), 'calendar_scripts' ))) {
        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' );
    }

  endif;   
}
add_action( 'template_redirect', 'add_calendar_to_pages' );

Then you have the option to either install a plugin that will allow you to add a shortcode to a text widget. Or you install this plugin that lets you add PHP code to a widget.

If you go with a text widget, you add [ESPRESSO_CALENDAR] to the text widget.

If you go with the PHP widget, you add the following to the PHP widget:

<?php
echo do_shortcode('[ESPRESSO_CALENDAR]');


denise

October 19, 2015 at 11:02 pm

Hi Josh,

Thanks for your continued support. I added to the function, to functions.php in my child-theme. But it did not seem to make a difference. I tried both the PHP plugin and I am using Shortcode ULITMATE to allow the shortcodes in the text widget. Neither seem to be working. When I am running the shortcode call, and inspect the css on my regular calendar and the widget calendar, the widget calendar div is 0px which is different than the regular calendar in a PAGE with a shortcode, not sure if that helps at all.

Currently my page is being set to use the PHP.

Another thing to note is that the other events espresso widgets don’t have any problems with the theme, the cart widget and the events widget work fine, its just the calendar widget that isn’t working.

What do you think I should try next?

Thanks!
Denise


Josh

  • Support Staff

October 20, 2015 at 9:18 am

Hi Denise,

The next step is clear away the two JavaScript errors that are being thrown at slider.js. What I suggest is dequeue the slider.js script from the calendar page, it’s not needed on that page if there isn’t a slider.


denise

October 21, 2015 at 10:55 am

Hi Josh,

I think I fixed the java issue? I removed the slider option from the theme on that page and it should now have a title instead. Can you let me know what is next?

Thanks!
Denise


Josh

  • Support Staff

October 21, 2015 at 2:35 pm

Hi Denise,

I checked and the web page is still throwing JavaScript errors.

These are the errors along with the filenames and line numbers:
portfolio.js:64
Uncaught ReferenceError: $galleryslider is not defined
wp-content/themes/dynamo/scripts/portfolio.js:64

Uncaught TypeError: Cannot read property ‘toString’ of undefined
wp-content/themes/dynamo/scripts/slider.js:27

I still suggest removing the actual scripts from the page. WordPress has a built in function that lets you programmatically remove scripts from specific pages. Can you find in the theme’s functions file where these two scripts are enqueued?


denise

October 23, 2015 at 1:09 pm

Hi Josh,

This was the response from my theme people when I asked them about removing the scripts:
*********************
Those scripts have no assets on the page so the console messages are expected and should have no bearing on the plugin shortcodes rendering or not (the plugin assets load after the theme always). In general, the burden of resolving compatibility issues (if they exist) is on the plugin developer since they have more control over load priority.

In your example page, there is no content loading in the text widget at all. If this was a javascript conflict, you would see the shortcode content load with broken javascript functionality. We have tested Event Espresso Decaf, WordPress core and ShortCode Ultimate shortcodes and they all work in this template without issue. It is important to note that we are using ShortCodes Ultimate’s widget, so please be sure you are also doing this and have all other non-critical plugins (including text widget plugins) deactivated while testing. Here is a screenshot of the ticket selector with the toggle expanded and main events listing shortcodes in the “side by side” panel:
***********************

I’m at a loss as to what to do next. The other EE widgets work on the widgetized page, but not the calendar one?

What else can I try?

Thanks
Denise


denise

October 23, 2015 at 1:41 pm

Hi Josh,

So let me summarize and maybe we can take a step back as to what I want to do. I want to show the calender on one side of a page and the events cart on the other side of the page.

If I use the ESPRESSO_CALENDAR widget or Shortcode in a widgetized page it doesn’t work. The other EE widgets work, but not this one.

If I use the [ESPRESSO_CALENDAR] Shortcode in a page, it works fine. Is there a shortcode for the events cart so that I can just use it that way?

Here is the widgetized page: on one side I have the ee calendar widget, then the ee carts widget, then the calendar shortcode:

http://miyceramics.com/class-calendar-widget/

Here is the full width page with the shortcode in three columns as well:

http://miyceramics.com/full-page/


Josh

  • Support Staff

October 23, 2015 at 3:14 pm

The calendar generally will not load if there’s a JavaScript error on the page, and this is because the calendar’s html is generated with JavaScript. The comments from the theme support are less than helpful. If they can simply point out how to disable the scripts on a specific page it would be most helpful here, a missed opportunity I guess.

Maybe we can take a look at the theme code and suggest where to go next. Can you send us a copy of the theme? Or maybe you can upload the theme to dropbox and post a link here.


denise

October 23, 2015 at 3:42 pm

Here is a copy of the theme:
https://www.dropbox.com/s/r72uaqqlb4yo728/dynamo-164.zip?dl=0


Josh

  • Support Staff

October 23, 2015 at 8:39 pm

Hi Denise,

You can remove the Obox slider script that’s throwing the JavaScript errors on the class-calendar-widget page by adding this code to your functions file:

function remove_obox_scripts_that_break_stuff() {
    // dequeue the obox scripts that throw JS errors
    if ( is_page( 'class-calendar-widgets' ) ) {
        wp_dequeue_script( 'dynamo-slider' );
        // dequeue more obox dynamo scripts here if needed        
    }
}
add_action( 'wp_enqueue_scripts', 'remove_obox_scripts_that_break_stuff', 11 );

I tested the above code on my development box and when used along with the other script I shared with you, I have verified that the calendar displays on the “dynamo” widgetized page.


denise

October 24, 2015 at 11:21 am

Hi Josh,

Thanks for your support and continued patience. I add this function to my functions.php in my child theme copy of dynamo. It currently looks like this:
***************************************************************

<?php

/**********************/
/* Include parent OCMX files */
$folder = get_stylesheet_directory(). ‘../dynamo/ocmx/’;

/******************************************************/
function remove_obox_scripts_that_break_stuff() {
// dequeue the obox scripts that throw JS errors
if ( is_page( ‘class-calendar-widgets’ ) ) {
wp_dequeue_script( ‘dynamo-slider’ );
// dequeue more obox dynamo scripts here if needed
}
}
add_action( ‘wp_enqueue_scripts’, ‘remove_obox_scripts_that_break_stuff’, 11 );

/*************CALENDAR IN WIDGETS SHORT CODE***********/
function add_calendar_to_pages() {
if ( class_exists( ‘EED_Espresso_Calendar’ ) && is_page( ‘class-calendar-widgets’ ) ) :

global $is_espresso_calendar;
$is_espresso_calendar = TRUE;
if ( ! has_action( ‘wp_enqueue_scripts’, array( EED_Espresso_Calendar::instance(), ‘calendar_scripts’ ))) {
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’ );
}

endif;
}
add_action( ‘template_redirect’, ‘add_calendar_to_pages’ );

?>

*********************************************

I have both functions you specified, but It is still not working :(.

Did I do something wrong in where I put your function?


Josh

  • Support Staff

October 26, 2015 at 9:24 am

Did you activate the child theme, or is the parent theme still active?


Josh

  • Support Staff

October 26, 2015 at 11:21 am

Also, if the child theme is active, you instead load the two functions from a functions plugin.


denise

October 26, 2015 at 2:31 pm

Hi Josh,

Thanks for your continued support. I have a child theme and I have it activated. I have a functions.php in my child theme and I added your two functions to it. It was not working. I then removed those scripts from functions.php and added them to a “functions” plugin like you mentioned, I have other EE functions defined in there and they work fine. There is still not change on the widgetized page.

I also spoke with my theme people and they said the following:

“If the calendar will not load alongside other javascripts, it will not be compatible with the widget layout or in combination with many plugins which are loading scripts on your pages. In general scripting should be loading in no-conflict mode in the footer or with a priority to ensure it loads in an order that allows it to work (either earliest or latest)”

Did I do something wrong with the functions plugin? Is there a way to tell if those functions are being called?

When you tried it setup the widgetized page, are you using the Shortcode or the actual widget under appearance->Widgets? I tried both the shortcode and the widget and they are still not showing up. 🙁

THanks
Denise


Josh

  • Support Staff

October 26, 2015 at 6:38 pm

I suspect the code you added is not loading. If it did load, the slider scripts would not still be throwing errors, because the slider script would not be on the page.

It may be that class-calendar-page isn’t actually the page slug for that page. So you could trying changing (in both functions)
is_page( 'class-calendar-widgets' )
to be:
is_page( 4186 )
That’s the page ID of the page where you have the widgets set up.


denise

October 26, 2015 at 8:57 pm

YOU ARE A GENIUS!!!! THANK YOU THANK YOU THANK YOU!

I owe you a cup of coffee or something. Is there anywhere I can do that?


denise

October 26, 2015 at 9:08 pm

Hmmm when I first tried it, I got the event images and titles?! I added the cart widget as well, and now all I get are a bunch of little flags? I can’t get the images again :(? Sorry….

http://miyceramics.com/class-calendar-widget/

Denise


Josh

  • Support Staff

October 27, 2015 at 10:36 am

Hi Denise,

It looks like you’ve switched over to using the Event Espresso Calendar widget, where before you had the echo do_shortcode in the PHP widget.


denise

October 27, 2015 at 3:02 pm

HI Josh,

The PHP shortcode call works. I thought this would have fixed the calendar widget too?


Josh

  • Support Staff

October 27, 2015 at 3:23 pm

No the calendar widget is programmed to only show the flags because it’s generally displayed in small spaces.

The code I shared with you does two things: 1) It loads the calendar assets onto a page where the Calendar Shortcode isn’t actually in the page content (like on your widgetized page), and it 2) removes the Obox slider script that was throwing JavaScript errors which resulted in the JavaScript Calendar not rendering. I can advise sticking with the PHP do_shortcode version of the calendar.

The support post ‘[ESPRESSO_CALENDAR] Shortcode within a text widget?’ 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