wordpress template_include 过滤器钩子

Published
April 19, 2022
浏览次数 :  4

function loadTemplate($template) {
//if is page pet-adoption use the inc/template-pets.php template else use the default template for the wordpress url
if (is_page(‘pet-adoption’)) {
return plugin_dir_path(FILE) . ‘inc/template-pets.php’;
}
return $template;
}

add_filter(‘template_include’, array($this, ‘loadTemplate’), 99);

Top