变更集57944
图例:
未修改 补充 远离的
-
trunk/src/wp-includes/block-template-utils.php 57928兰特 57944兰特 1398 1398 函数get_template_hierarchy($slug,$is_custom=false,$template_prefix=''){ 1399 1399 if(“索引”===$slug){ 1400 返回数组(“index”); 1400 /**此过滤器记录在wp-includes/template.php中*/ 1401 return apply_filters('index_template_hierarchy',数组('index')); 1401 1402 } 1402 1403 if($is_custom){ 1403 返回数组(“page”,“singular”,“index”); 1404 /**此筛选器记录在wp-includs/template.php中*/ 1405 return apply_filters(“page_template_hierarchy”,数组(“page”,“singular”,“index”); 1404 1406 } 1405 1407 if(“front-page”===$slug){ 1406 返回数组(“front-page”、“home”、“index”); 1408 /**此过滤器记录在wp-includes/template.php中*/ 1409 return apply_filters('frontpage_template_hierarchy',array('frent-page','home','index')); 1407 1410 } 1408 1411 … … 1470 1473 } 1471 1474 $template_hierarchy[]=“索引”; 1475 1476 $template_type=“”; 1477 if(!空($template_prefix)){ 1478 list($template_type)=分解('-',$template_prefix); 1479 }其他{ 1480 列表($template_type)=爆炸('-',$slug); 1481 } 1482 $valid_template_types=数组('404','archive','attachment','author','category','date','embed','frontpage','home','index','page','paged','privacypolicy','搜索','single','signal','tag','分类法'); 1483 if(in_array($template_type,$valid_template_types)){ 1484 /**此过滤器记录在wp-includes/template.php中*/ 1485 返回apply_filters(“{$template_type}_template_hierarchy”,$template_hierarchies); 1486 } 1472 1487 返回$template_hierarchy; 1473 1488 } -
trunk/tests/phpunit/tests/block-templates/getTemplateHierarchy.php 55194兰特 r57944美元 42 42 43 43 /** 44 *@车票60846 45 */ 46 公共函数test_get_template_hierarchy_with_hooks(){ 47 添加筛选器( 48 '日期模板层次结构', 49 函数($templates){ 50 return array_merge(数组('date-custom'),$templates); 51 } 52 ); 53 $expected=数组('date-custom','date','archive','index'); 54 $this->assertSame($expected,get_template_hierarchy('date')); 55 } 56 57 /** 44 58 *数据提供商。 45 59 *