반응형
wordpress로 스크립트를 큐잉할 때 get_stylesheet_directory_uri()와 get_template_directory_uri()의 차이점은 무엇입니까?
그건 심각한 질문이 아니에요.
저는 평소에get_stylesheet_directory_uri()
WordPress에서 스크립트를 큐잉할 때, 지금까지는 정상적으로 동작했습니다.
그냥 궁금할 뿐이야get_stylesheet_directory_uri()
그리고.get_template_directory_uri()
wordpress에서 스크립트를 큐잉할 때 사용합니다.
WordPress Codex에 따르면:
get_template_directory_uri
-> 현재 테마의 템플릿디렉토리 URI 를 취득합니다.get_stylesheet_directory_uri
-> 현재 테마/자녀 테마 스타일시트 디렉토리 URI를 가져옵니다.
그리고나서,get_template_directory_uri
하위 테마에 사용할 수 없습니까?
두 기능 모두 상위 또는 하위 테마에서 사용할 수 있습니다.
get_directory_uri는 항상 자산의 부모 테마 폴더를 참조합니다.
get_stylesheet_directory_uri는 자산의 "현재" 테마 폴더를 참조합니다(호출처에 따라 부모 또는 자녀일 수 있습니다).
예를 들어 하위 테마에서 다음을 수행합니다.
// This will point to style.css in child theme
wp_enqueue_style( 'my_child_styles', get_stylesheet_directory_uri().'/style.css' );
// This will point to style.css in the parent theme
wp_enqueue_style( 'my_parent_styles', get_template_directory_uri().'/style.css' );
테마가 하위 테마가 아닌 경우 상위 테마로 간주됩니다.
언급URL : https://stackoverflow.com/questions/31797203/whats-the-difference-between-get-stylesheet-directory-uri-and-get-template-di
반응형
'programing' 카테고리의 다른 글
AngularJS 상수 (0) | 2023.02.17 |
---|---|
javascript에서 문자열 배열을 배열로 변환 (0) | 2023.02.17 |
Oracle에서의 뷰란? (0) | 2023.02.17 |
반응의 공리에서 반응 상태를 설정하는 방법 (0) | 2023.02.17 |
AJAX 및 브라우저의 뒤로 버튼 (0) | 2023.02.17 |