-
-
Save Pebblo/62749ca6a3951e860c474d6d206300a9 to your computer and use it in GitHub Desktop.
An example of how to add a custom directory to the locate_template function used within Event Espresso 4. This function simply adds a check for templates within /{wp_theme}/espresso/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Do not include the opening php tag if you already have one open. | |
//This function adds an additional check to locate_template | |
function check_theme_directory_espresso_locate_template( $full_template_paths, $template_filename ) { | |
//Build the new full template path to check within /{wp_theme}/espresso/ | |
$theme_espresso_template_dir = get_stylesheet_directory() . '/espresso/' . $template_filename; | |
//Add the new template path to the paths check by locate_template() | |
array_unshift( $full_template_paths, $theme_espresso_template_dir ); | |
//Debug using Kint to output all paths that will be checked. | |
//d($full_template_paths); | |
return $full_template_paths; | |
} | |
add_filter( 'FHEE__EEH_Template__locate_template__full_template_paths', 'check_theme_directory_espresso_locate_template', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment