Make WordPress Core

Ticket #14310: template_hierarchy.5.diff

File template_hierarchy.5.diff, 792 bytes (added by stevegrunwell, 9 years ago)

Refreshed for WordPress 4.3 + includes inline documentation for the new filter.

  • wp-includes/template.php

     
    2626        if ( empty( $templates ) )
    2727                $templates = array("{$type}.php");
    2828
    29         $template = locate_template( $templates );
     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         * @param array $templates A list of template candidates, in ascending order of priority.
     35         */
     36        $templates = apply_filters( "{$type}_template_hierarchy", $templates );
     37        $template  = locate_template( $templates );
    3038
    3139        /**
    3240         * Filter the path of the queried template by type.