Skip to content

Instantly share code, notes, and snippets.

@alshedupur
Created October 4, 2023 17:44
Show Gist options
  • Save alshedupur/aea253dd98b786be2950e293235028a0 to your computer and use it in GitHub Desktop.
Save alshedupur/aea253dd98b786be2950e293235028a0 to your computer and use it in GitHub Desktop.
Override the Events Calendar template from Enfold to Enfold Child. Add this code to your child themes functions.php
add_action('after_setup_theme', 'enfold_child_theme_code');
function enfold_child_theme_code() {
if (is_child_theme()) {
remove_action('tribe_events_template', 'avia_events_template_paths', 10, 2);
//add_filter('tribe_events_template_paths', 'avia_events_template_paths_mod', 10, 2);
}
}
add_action('tribe_events_template', 'avia_events_template_paths_mod', 10, 2);
function avia_events_template_paths_mod($template, $template_name) {
$child_theme_path = get_stylesheet_directory() . "/tribe-events/views/" . $template_name;
$parent_theme_path = get_template_directory() . "/config-events-calendar/views/" . $template_name;
if (file_exists($child_theme_path)) {
return $child_theme_path;
} elseif (file_exists($parent_theme_path)) {
return $parent_theme_path;
}
return $template;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment