wordpress怎么实现模板根据优先级来选用加载?

描述问题:比如,pages-{$x}.php  -> pages.php  -> index.php
相关文件与目录:
文件Template.php,文件genenal-template.php,目录 wp-includes\theme-compat
genenal-template.php中的函数get_header(  ) template.php中的函数locate_template()

 

1、在get_header()中生产参数,并调用locate_template()函数 

wordpress怎么实现模板根据优先级来选用加载?

 2locate_template()函数中的优先选择过程

wordpress怎么实现模板根据优先级来选用加载?

 3、默认模板的目录为wp-includes\theme-compat,默认模板见下

wordpress怎么实现模板根据优先级来选用加载?