wordpress template_include 过滤器钩子

Published
2022-04-19
浏览次数 :  32

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);

  • 标签1
  • 标签1
  • 标签1
Top