Support forumCategory: QuestionsHow to show Easy Appointments via ajax call to WP admin-ajax.php in a multi-step form
peter_baturenko asked 2 years ago

Hi Nikola,

Thank you very much for the awesome plugin. Everything works great – after working with the code I can tell you’ve put a lot of thought and effort into it.

I’m trying to extend the functionality of the plugin with a multi-step form which loads Easy Appointments via ajax call to admin-ajax.php. My understanding is that admin-ajax.php cannot output WP shortcodes, so my attempt to do:



wasn’t successful. My initial attempt was to add this to my theme’s functions.php file:

add_action('wp_ajax_get_reservation_form', 'get_reservation_form');
add_action('wp_ajax_nopriv_get_reservation_form', 'get_reservation_form');

function get_reservation_form () {

$eaBootstrap = require_once(WP_PLUGIN_DIR . '/easy-appointments/main.php');

echo $eaBootstrap;


I was able to confirm that $ea_app at the very end of main.php gets instantiated via the ajax call, but when trying to call ea_bootstrap function with code parameters, e.g.

$eaParams = array (
'location' => 1,
'service' => 1,
'worker' => 1,
'scroll_off' => true,
'layout_cols' => '1',
'width' => '800px'


$eaObject = new EAFrontend;

my code returns an error => PHP Fatal error: Uncaught Error: Call to a member function get_options() on null.

Any idea what I’m doing wrong? Thank you very much in advance for your help,


2 Answers
Nikola Loncar Staff answered 2 years ago

Hi Peter,

you want to change Calendar based on selection on first step? Sorry for waiting my response 🙁

Best regards,

jakub answered 5 months ago

I Peter or Nikola.

Did you get the shortcode working in admin-ajax? 

I want to show our calendar on a tab that is loaded via admin-ajax and it shows the shortcode text in the tab:

Instead of the shortcode content… So how can I register this shortcode to get it working even in ajax loaded tab?

Nikola Loncar Staff replied 5 months ago

Hi Jakub, can you please tell me where you want to render form?

Best regards,

jakub replied 5 months ago

This is our test website: I want to show it on the “teetime” tab.
The same shortcode works fine here
The teetime tab is loaded via admin-ajax.php
Other shortcodes works there. For example this tab is made by some other shortcode

Nikola Loncar Staff replied 5 months ago

Hi Jakub, I get it now. There is no easy solution for this but you can do something else. Create a empty page with just EA form. So you then you can include that page as iframe into that second tab. That will work without problem.

Best regards,

jakub replied 5 months ago

Hi Nikola. Thank you very much for your answer. I was thinking about iframe as the last option. That is not really profesinal way to do that. Do you know any freelancer or profesional that would write a custom solution for us? I will need some more modifications. For example a dashboard for our users (listing owners) where they could manage their timeslots

Nikola Loncar Staff replied 5 months ago

If you want some customization I can also do that for you. Can you please share more info so we can calculate price and time. You can send it to nikolanbg[at]gmail[dot]com

Best regards,