小编Ale*_*wan的帖子

wc_get_template 返回 null

我似乎无法wc_get_template()返回我的页面模板。我确定路径是正确的,我将它存储在我的子主题文件夹中,但是当我运行它时,我得到NULL. 你能看出这里有什么问题吗?

public function endpoint_content() { 

    // The template name. 
    $template_name = 'Students Details'; 

    // (default: array()) 
    $args = array(); 

    // The template path. 
    $template_path =  get_stylesheet_directory().'/woocommerce/myaccount/add_students.php';

    // NOTICE! Understand what this does before running. 
    $res = wc_get_template($template_name, $args, $template_path, $template_path);

    var_dump($res); 
}
Run Code Online (Sandbox Code Playgroud)

php wordpress woocommerce

3
推荐指数
1
解决办法
2722
查看次数

标签 统计

php ×1

woocommerce ×1

wordpress ×1