Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created May 25, 2018 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/eb77e0c3ce13e52afb4482f52aa642cf to your computer and use it in GitHub Desktop.
Save Pebblo/eb77e0c3ce13e52afb4482f52aa642cf to your computer and use it in GitHub Desktop.
Example of how to include EE template_tags.php file in the requests used by page builders.
<?php //Please do not include the opening PHP tag if you already have one
function tw_ee_require_template_tags() {
//Pull the current action from the request.
$action = EE_Registry::instance()->REQ->get('action', '');
//Build an array of page builder actions to load the template_tags.php file on.
$page_builder_actions = array(
'elementor',
'elementor_ajax'
);
//Check if the current action matches any of the page builder actions above
if( in_array($action, $page_builder_actions) ) {
//If espresso_event_date_range is not defined, include the template_tags.php file
if( ! function_exists('espresso_event_date_range') ) {
require_once EE_PUBLIC . 'template_tags.php';
}
}
}
add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'tw_ee_require_template_tags');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment