2017-12-04 6 views
0

어디에서나 검색 한 결과 찾을 수 없습니다.
이제 내 유일한 희망입니다. 제발 도와주세요.
전체 사용을위한 사용자 정의 페이지 템플릿, WordPress 템플릿 드롭 다운에 표시되지 않음

전체 사용을위한 사용자 정의 페이지 템플리트, 템플릿 부분에 대한 사용자 정의 플러를 만들 때 WordPress 템플릿 드롭 다운에 표시되지 않습니다.

내-테마/global_template.php 작업
내-테마/템플릿 부품/global_template.php 작업
내-테마/템플릿 부품/아카이브/global_template.php가 작동하지 않습니다

템플릿이 들어있는 템플릿 내부의 페이지 속성 -> 템플릿에 폴더를 만들려면 어떻게해야합니까? 여기

Custom page template loaction

코드가 내부 global_template.php


더 테스트 템플릿이 없다시피

Custom page template code ..
page attributes

+0

블로깅 캐싱. 이것은 4.9에 도입 된 새로운 '기능'입니다. https://stackoverflow.com/questions/47558838/wordpress-the-templates-drop-down-menu-lists-up-to-9-items?noredirect=1#comment82141479_47558838 – McNab

+0

안녕하세요, 4.9의 WordPress에 캐싱 문제가 있습니다. 하지만 템플릿이 작동하는 것은 아닙니다 ... 그러나 일부 폴더에서만 가능합니다. – Andrey

답변

1

귀하의 문제가있다 깊이가 함수를 얻을 깊이 emplates는 1 깊이가 있습니다. 따라서 테마 루트 또는 첫 번째 하위 폴더에 파일을 넣어야합니다.

핵심 기능 get_post_templates()get_files()을 깊이 1로 호출하고 디렉토리를 검색하는 기능 scandir()으로 전달합니다.

add_filter{$post_type}을 서식 파일을 추가 할 게시 유형으로 바꿀 수 있습니다. 예 : page.

/** 
* @param array $post_templates Array of page templates. 
* Keys are filenames, values are translated names. 
*/ 
function extend_post_type_templates($post_templates, $this, $post, $post_type) { 
    $post_templates['template-parts/archive/global_template.php'] = 'Name for this'; 
    return $post_templates; 
} 
add_filter('theme_{$post_type}_templates', 'extend_post_type_templates', 10, 4); 
+0

그럼 WordPress의 제한 사항입니까? 하드 코드하지 않고 깊이를 변경할 수 있습니까? – Andrey

+0

예 대답을 지금보십시오. – Shibi

관련 문제