Support

Home Forums Event Espresso Premium Shortcode in Javascript

Shortcode in Javascript

Posted: May 21, 2013 at 5:52 pm


Hansteen

May 21, 2013 at 5:52 pm

I would like to have a  drop-down menu that uses javascript to allow users to select a category to display in the calendar, but I’m not sure how to call the calendar shortcode in the javascript. Is this possible? Thanks.


Dean

May 22, 2013 at 12:59 am

Hello,

You would need to use AJAX to call the PHP function that does whatever you need.

http://codex.wordpress.org/AJAX

It is likely that you will need to use the do_shortcode() function within the PHP code block as well.

http://codex.wordpress.org/do_shortcode

As the calendar is made in javascript I would also advise you to take a look at the base files, which can be found here http://arshaw.com/fullcalendar/docs/


Hansteen

May 22, 2013 at 10:47 am

Thanks. Before I get into the AJAX, I seem to be having trouble even getting a calendar to show up when I use a custom template. Is the following the correct way to insert a calendar into a template file:

echo do_shortcode(‘[ESPRESSO_CALENDAR cal_view=”basicWeek”]’);


Josh

  • Support Staff

May 22, 2013 at 11:17 am

That should work as long as it’s within a PHP block. If it’s not in a PHP block, it would be:

<php echo do_shortcode('[ESPRESSO_CALENDAR cal_view="basicWeek"]'); ?>


Hansteen

May 22, 2013 at 12:40 pm

Thanks!

The support post ‘Shortcode in Javascript’ 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