| 629 | | function locate_template($template_names, $load = false, $require_once = true ) { |
| 630 | | $located = ''; |
| | 631 | function locate_template($template_names, $load = false, $require_once = true, $type = null ) { |
| | 632 | |
| | 633 | $located = ''; |
| | 634 | |
| | 635 | /** |
| | 636 | * Filters the path to the template files that are searched for when retrieving a template to use. |
| | 637 | * |
| | 638 | * If the filter is not triggered, the templates are expected to be in their default |
| | 639 | * location (the theme root). |
| | 640 | * |
| | 641 | * If the filter is triggered and a directory name is returned, then WordPress will |
| | 642 | * look in that directory (relative ancestor to the theme root) for the files. |
| | 643 | * |
| | 644 | * This filter also moves the location of all template parts such as header.php, footer.php ect ect |
| | 645 | * @since 4.7.0 |
| | 646 | * |
| | 647 | * @param string $path A Directory name which contains all the template files, relative to the theme root. |
| | 648 | */ |
| | 649 | $path = apply_filters("templates_path", ''); |
| | 650 | $path = isset($path) ? trailingslashit($path) : $path; |
| | 651 | |
| | 652 | /** |
| | 653 | * Filters the path to the template files, based on type, that are searched |
| | 654 | * for when retrieving a template to use. |
| | 655 | * |
| | 656 | * |
| | 657 | * Possible values for `$type` include: 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', |
| | 658 | * 'embed', 'home', 'frontpage', 'page', 'paged', 'search', 'single', 'singular', and 'attachment'. |
| | 659 | * |
| | 660 | * @param string $path A Directory name which contains all the template files, relative to the theme root. |
| | 661 | */ |
| | 662 | $path = apply_filters("{$type}_templates_path", $path); |
| | 663 | $path = isset($path) ? trailingslashit($path) : $path; |
| | 664 | |
| | 665 | |