I’m using the Central-theme that’s using ajax to loading pages. Unfortunately the makers don’t seem to go the usual worpress codex ajax-way
so checks like the following one will fail:
if (defined('DOING_AJAX') && DOING_AJAX)
Still I can do a general ajax check which works fine but I’m not sure how exactly and which eo files I should load. The code’s placed inside my configuration plugin.
define( 'EVENT_ORGANISER_DIR', '../event-organiser/' );
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
!empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
require_once(EVENT_ORGANISER_DIR.'event-organiser.php');
}
Actually the only case where I have to initialize eo by myself is before calling the booking form via shortcode [event_booking_form]. The Datepicker isn’t there…

Adrian Maleska
Central-theme is doing it wrong then I’m afraid 🙂 Ajax requests should go to ../wp-admin/admin-ajax.php
(for frontend or admin originated ajax calls), as that loads WordPress properly.
In any case to load Event Organiser, you must first load WordPress – in fact if you load WordPress it’ll automatically load Event Organiser (if activated).
This what WordPress does it: https://github.com/WordPress/WordPress/blob/3.8-branch/wp-admin/admin-ajax.php
- Bootstraps WP via
wp-load.php
- Sets appropriate headers
- Triggers the appropriate reaction so plug-ins can respond.
But obviously you’d need to determine where wp-load.php
is in order to load it. If using a custom file to handle ajax then there’s no real point in implementing (3).
But really this a massive but with the theme..

Stephen Harris
Thank you Stephen for this interesting insights. I’m new to wp so I still have to learn what the right way is to do certain things. On my own old webpage I would just load the init php files and done. In this case it’s tougher. Fortunatelly the theme is doing one good thing (besides looking great) – it allows to exclude certain uri’s from being loaded . This is my option for now. I will fight against ajax an other day … after xmas 😉

Adrian Maleska