wc_get_template()
페이지 서식 파일을 반환하지 못하는 것 같습니다. 경로가 내 자식 테마 폴더에 저장되어있는 위치가 맞는지는 확실하지만 실행하면 NULL
이됩니다. 여기에 뭐가 잘못 보이니?null을 반환하는 wc_get_template
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);
}
['wc_get_template()'] (https://docs.woocommerce.com/wc-apidocs/source-function-wc_get_template.html#177-206) 함수의 코드를 보면 예상대로 작동하지 않습니다. 아무것도 돌려 보내라. 다른 문서에서는 'returns : void'를 지정합니다. – Henders
어쩌면 [wc_get_template_html()'] (https://github.com/woothemes/woocommerce/blob/master/includes/wc-core-functions.php)에서 '_... wc_get_template'과 비슷하지만 대신 html로 출력하십시오. ' – Henders
@Henders 답장을 보내 주셔서 감사합니다. 그래서 wc_get_template_html() 및 그 반환 된 문자열 (0) ""그래서 궁금 오전 그것은 어쩌면 그것은 자식 테마이기 때문에 노력했다. include 문을 사용하면 잘 작동합니다. 그러나 나는 그 좋은 습관이 있는지 모른다. –