Changeset 17214
- Timestamp:
- 01/04/2011 07:23:41 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r17213 r17214 729 729 * Retrieve path to a template 730 730 * 731 * Used to quickly retrieve the path of a template without including the file732 * extension. It will also check the parent t heme, if the file exists, with733 * the use of {@link locate_template()}. Allows for more generic template location731 * Used to quickly retrieve the path of file without including the file 732 * extension. It will also check the parent template, if the file exists, with 733 * the use of {@link locate_template()}. Allows for more generic file location 734 734 * without the use of the other get_*_template() functions. 735 735 * 736 * Can be used with include() or require() to retrieve path. 737 * <code> 738 * if( '' != get_query_template( '404' ) ) 739 * include( get_query_template( '404' ) ); 740 * </code> 741 * or the same can be accomplished with 742 * <code> 743 * if( '' != get_404_template() ) 744 * include( get_404_template() ); 745 * </code> 746 * 736 747 * @since 1.5.0 737 748 * 738 749 * @param string $type Filename without extension. 739 * @param array $templates An optional list of template candidates740 750 * @return string Full path to file. 741 751 */ 742 function get_query_template( $type, $templates = array()) {752 function get_query_template($type) { 743 753 $type = preg_replace( '|[^a-z0-9-]+|', '', $type ); 744 745 if ( empty( $templates ) ) 746 $templates = array("{$type}.php"); 747 748 $templates = apply_filters( "{$type}_template_hierarchy", $templates ); 749 750 return apply_filters( "{$type}_template", locate_template( $templates ) ); 754 return apply_filters("{$type}_template", locate_template(array("{$type}.php"))); 751 755 } 752 756 … … 808 812 $templates[] = 'author.php'; 809 813 810 return get_query_template( 'author', $templates ); 814 $template = locate_template( $templates ); 815 return apply_filters( 'author_template', $template ); 811 816 } 812 817 … … 832 837 $templates[] = "category.php"; 833 838 834 return get_query_template( 'category', $templates ); 839 $template = locate_template($templates); 840 return apply_filters('category_template', $template); 835 841 } 836 842 … … 856 862 $templates[] = "tag.php"; 857 863 858 return get_query_template( 'tag', $templates ); 864 $template = locate_template($templates); 865 return apply_filters('tag_template', $template); 859 866 } 860 867 … … 886 893 $templates[] = "taxonomy.php"; 887 894 888 return get_query_template( 'taxonomy', $templates ); 895 $template = locate_template($templates); 896 return apply_filters('taxonomy_template', $template); 889 897 } 890 898 … … 913 921 */ 914 922 function get_home_template() { 915 $templates = array( 'home.php', 'index.php' ); 916 917 return get_query_template( 'home', $templates ); 923 $template = locate_template(array('home.php', 'index.php')); 924 return apply_filters('home_template', $template); 918 925 } 919 926 … … 929 936 */ 930 937 function get_front_page_template() { 931 $templates = array('front-page.php'); 932 933 return get_query_template( 'front_page', $templates ); 938 return apply_filters( 'front_page_template', locate_template( array('front-page.php') ) ); 934 939 } 935 940 … … 968 973 $templates[] = "page.php"; 969 974 970 return get_query_template( 'page', $templates);975 return apply_filters('page_template', locate_template($templates)); 971 976 } 972 977 … … 1051 1056 */ 1052 1057 function get_comments_popup_template() { 1053 $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ));1058 $template = locate_template(array("comments-popup.php")); 1054 1059 1055 1060 // Backward compat code will be removed in a future release … … 1057 1062 $template = ABSPATH . WPINC . '/theme-compat/comments-popup.php'; 1058 1063 1059 return $template;1064 return apply_filters('comments_popup_template', $template); 1060 1065 } 1061 1066
Note: See TracChangeset
for help on using the changeset viewer.