Changeset 57944 for trunk/src/wp-includes/block-template-utils.php
- Timestamp:
- 04/08/2024 04:45:22 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template-utils.php
r57928 r57944 1398 1398 function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '' ) { 1399 1399 if ( 'index' === $slug ) { 1400 return array( 'index' ); 1400 /** This filter is documented in wp-includes/template.php */ 1401 return apply_filters( 'index_template_hierarchy', array( 'index' ) ); 1401 1402 } 1402 1403 if ( $is_custom ) { 1403 return array( 'page', 'singular', 'index' ); 1404 /** This filter is documented in wp-includes/template.php */ 1405 return apply_filters( 'page_template_hierarchy', array( 'page', 'singular', 'index' ) ); 1404 1406 } 1405 1407 if ( 'front-page' === $slug ) { 1406 return array( 'front-page', 'home', 'index' ); 1408 /** This filter is documented in wp-includes/template.php */ 1409 return apply_filters( 'frontpage_template_hierarchy', array( 'front-page', 'home', 'index' ) ); 1407 1410 } 1408 1411 … … 1470 1473 } 1471 1474 $template_hierarchy[] = 'index'; 1475 1476 $template_type = ''; 1477 if ( ! empty( $template_prefix ) ) { 1478 list( $template_type ) = explode( '-', $template_prefix ); 1479 } else { 1480 list( $template_type ) = explode( '-', $slug ); 1481 } 1482 $valid_template_types = array( '404', 'archive', 'attachment', 'author', 'category', 'date', 'embed', 'frontpage', 'home', 'index', 'page', 'paged', 'privacypolicy', 'search', 'single', 'singular', 'tag', 'taxonomy' ); 1483 if ( in_array( $template_type, $valid_template_types ) ) { 1484 /** This filter is documented in wp-includes/template.php */ 1485 return apply_filters( "{$template_type}_template_hierarchy", $template_hierarchy ); 1486 } 1472 1487 return $template_hierarchy; 1473 1488 }
Note: See TracChangeset
for help on using the changeset viewer.