use get_stylesheet_directory() instead of get_template_directory()
-
In lib/shortcodes.php, you should be using get_stylesheet_directory or your template files won’t work with child themes. get_template_directory always returns the parent theme.
function loadTemplate( $template, $vars = array() ) { global $leaguemanager, $lmStats, $championship; extract($vars); ob_start(); if ( file_exists( get_stylesheet_directory() . "/leaguemanager/$template.php")) { include(get_stylesheet_directory() . "/leaguemanager/$template.php"); } elseif ( file_exists(LEAGUEMANAGER_PATH . "/templates/".$template.".php") ) { include(LEAGUEMANAGER_PATH . "/templates/".$template.".php"); } else { parent::setMessage( sprintf(__('Could not load template %s.php', 'leaguemanager'), $template), true ); parent::printMessage(); } $output = ob_get_contents(); ob_end_clean(); return $output; }
- The topic ‘use get_stylesheet_directory() instead of get_template_directory()’ is closed to new replies.