WordPress.org

Make WordPress Core

Ticket #14310: template_hierarchy.6.diff

File template_hierarchy.6.diff, 1.4 KB (added by johnbillion, 5 years ago)
  • src/wp-includes/template.php

     
    2626        if ( empty( $templates ) )
    2727                $templates = array("{$type}.php");
    2828
     29        /**
     30         * Filter the list of templates that should be passed to locate_template().
     31         *
     32         * The last element in the array should always be the fallback template for this query type.
     33         *
     34         * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',
     35         * 'home', 'front_page', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
     36         *
     37         * @since 4.4.0
     38         *
     39         * @param array $templates A list of template candidates, in descending order of priority.
     40         */
     41        $templates = apply_filters( "{$type}_template_hierarchy", $templates );
     42
    2943        $template = locate_template( $templates );
    3044
    3145        /**
     
    3549         * extension and any non-alphanumeric characters delimiting words -- of the file to load.
    3650         * This hook also applies to various types of files loaded as part of the Template Hierarchy.
    3751         *
     52         * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date',
     53         * 'home', 'front_page', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'.
     54         *
    3855         * @since 1.5.0
    3956         *
    4057         * @param string $template Path to the template. See locate_template().