Ticket #26742: 26742.3.patch
| File 26742.3.patch, 7.7 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/template.php
18 18 * 19 19 * @param string $type Filename without extension. 20 20 * @param array $templates An optional list of template candidates 21 * @return string Full path to file.21 * @return string Full path to template file. 22 22 */ 23 23 function get_query_template( $type, $templates = array() ) { 24 24 $type = preg_replace( '|[^a-z0-9-]+|', '', $type ); … … 44 44 /** 45 45 * Retrieve path of index template in current or parent template. 46 46 * 47 * The template path is filterable via the 'index_template' hook. 48 * 47 49 * @since 3.0.0 48 50 * 49 * @return string 51 * @see get_query_template() 52 * 53 * @return string Full path to index template file. 50 54 */ 51 55 function get_index_template() { 52 56 return get_query_template('index'); … … 55 59 /** 56 60 * Retrieve path of 404 template in current or parent template. 57 61 * 62 * The template path is filterable via the '404_template' hook. 63 * 58 64 * @since 1.5.0 59 65 * 60 * @return string 66 * @see get_query_template() 67 * 68 * @return string Full path to 404 template file. 61 69 */ 62 70 function get_404_template() { 63 71 return get_query_template('404'); … … 66 74 /** 67 75 * Retrieve path of archive template in current or parent template. 68 76 * 77 * The template path is filterable via the 'archive_template' hook. 78 * 69 79 * @since 1.5.0 70 80 * 71 * @return string 81 * @see get_query_template() 82 * 83 * @return string Full path to archive template file. 72 84 */ 73 85 function get_archive_template() { 74 86 $post_types = array_filter( (array) get_query_var( 'post_type' ) ); … … 87 99 /** 88 100 * Retrieve path of post type archive template in current or parent template. 89 101 * 102 * The template path is filterable via the 'archive_template' hook. 103 * 90 104 * @since 3.7.0 91 105 * 92 * @return string 106 * @see get_archive_template() 107 * 108 * @return string Full path to archive template file. 93 109 */ 94 110 function get_post_type_archive_template() { 95 111 $post_type = get_query_var( 'post_type' ); … … 106 122 /** 107 123 * Retrieve path of author template in current or parent template. 108 124 * 125 * The template path is filterable via the 'author_template' hook. 126 * 109 127 * @since 1.5.0 110 128 * 111 * @return string 129 * @see get_query_template() 130 * 131 * @return string Full path to author template file. 112 132 */ 113 133 function get_author_template() { 114 134 $author = get_queried_object(); … … 131 151 * trying category ID, for example 'category-1.php', and will finally fall back to category.php 132 152 * template, if those files don't exist. 133 153 * 154 * The template path is filterable via the 'category_template' hook. 155 * 134 156 * @since 1.5.0 135 * @uses apply_filters() Calls 'category_template' on file path of category template.136 157 * 137 * @return string 158 * @see get_query_template() 159 * 160 * @return string Full path to category template file. 138 161 */ 139 162 function get_category_template() { 140 163 $category = get_queried_object(); … … 157 180 * trying tag ID, for example 'tag-1.php', and will finally fall back to tag.php 158 181 * template, if those files don't exist. 159 182 * 183 * The template path is filterable via the 'tag_template' hook. 184 * 160 185 * @since 2.3.0 161 * @uses apply_filters() Calls 'tag_template' on file path of tag template.162 186 * 163 * @return string 187 * @see get_query_template() 188 * 189 * @return string Full path to tag template file. 164 190 */ 165 191 function get_tag_template() { 166 192 $tag = get_queried_object(); … … 188 214 * template is used. If none of the files exist, then it will fall back on to 189 215 * index.php. 190 216 * 217 * The template path is filterable via the 'taxonomy_template' hook. 218 * 191 219 * @since 2.5.0 192 * @uses apply_filters() Calls 'taxonomy_template' filter on found path.193 220 * 194 * @return string 221 * @see get_query_template() 222 * 223 * @return string Full path to taxonomy template file. 195 224 */ 196 225 function get_taxonomy_template() { 197 226 $term = get_queried_object(); … … 211 240 /** 212 241 * Retrieve path of date template in current or parent template. 213 242 * 243 * The template path is filterable via the 'date_template' hook. 244 * 214 245 * @since 1.5.0 215 246 * 216 * @return string 247 * @see get_query_template() 248 * 249 * @return string Full path to date template file. 217 250 */ 218 251 function get_date_template() { 219 252 return get_query_template('date'); … … 223 256 * Retrieve path of home template in current or parent template. 224 257 * 225 258 * This is the template used for the page containing the blog posts. 226 *227 259 * Attempts to locate 'home.php' first before falling back to 'index.php'. 228 260 * 261 * The template path is filterable via the 'home_template' hook. 262 * 229 263 * @since 1.5.0 230 * @uses apply_filters() Calls 'home_template' on file path of home template.231 264 * 232 * @return string 265 * @see get_query_template() 266 * 267 * @return string Full path to home template file. 233 268 */ 234 269 function get_home_template() { 235 270 $templates = array( 'home.php', 'index.php' ); … … 240 275 /** 241 276 * Retrieve path of front-page template in current or parent template. 242 277 * 243 * Looks for 'front-page.php'. 278 * Looks for 'front-page.php'. The template path is filterable via the 279 * 'front_page_template' hook. 244 280 * 245 281 * @since 3.0.0 246 * @uses apply_filters() Calls 'front_page_template' on file path of template.247 282 * 248 * @return string 283 * @see get_query_template() 284 * 285 * @return string Full path to front page template file. 249 286 */ 250 287 function get_front_page_template() { 251 288 $templates = array('front-page.php'); … … 260 297 * Then will search for 'page-{slug}.php', followed by 'page-{id}.php', 261 298 * and finally 'page.php'. 262 299 * 300 * The template path is filterable via the 'page_template' hook. 301 * 263 302 * @since 1.5.0 264 303 * 265 * @return string 304 * @see get_query_template() 305 * 306 * @return string Full path to page template file. 266 307 */ 267 308 function get_page_template() { 268 309 $id = get_queried_object_id(); … … 291 332 /** 292 333 * Retrieve path of paged template in current or parent template. 293 334 * 335 * The template path is filterable via the 'paged_template' hook. 336 * 294 337 * @since 1.5.0 295 338 * 296 * @return string 339 * @see get_query_template() 340 * 341 * @return string Full path to paged template file. 297 342 */ 298 343 function get_paged_template() { 299 344 return get_query_template('paged'); … … 302 347 /** 303 348 * Retrieve path of search template in current or parent template. 304 349 * 350 * The template path is filterable via the 'search_template' hook. 351 * 305 352 * @since 1.5.0 306 353 * 307 * @return string 354 * @see get_query_template() 355 * 356 * @return string Full path to search template file. 308 357 */ 309 358 function get_search_template() { 310 359 return get_query_template('search'); … … 313 362 /** 314 363 * Retrieve path of single template in current or parent template. 315 364 * 365 * The template path is filterable via the 'single_template' hook. 366 * 316 367 * @since 1.5.0 317 368 * 318 * @return string 369 * @see get_query_template() 370 * 371 * @return string Full path to single template file. 319 372 */ 320 373 function get_single_template() { 321 374 $object = get_queried_object(); … … 340 393 * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and 341 394 * finally 'text_plain.php'. 342 395 * 396 * The template path is filterable via the 'attachment_template' hook. 397 * 343 398 * @since 2.0.0 344 399 * 345 * @return string 400 * @see get_query_template() 401 * 402 * @return string Full path to attachment template file. 346 403 */ 347 404 function get_attachment_template() { 348 405 global $posts; … … 371 428 * Checks for comment popup template in current template, if it exists or in the 372 429 * parent template. 373 430 * 431 * The template path is filterable via the 'comments_popup_template' hook. 432 * 374 433 * @since 1.5.0 375 * @uses apply_filters() Calls 'comments_popup_template' filter on path.376 434 * 377 * @return string 435 * @see get_query_template() 436 * 437 * @return string Full path to comments popup template file. 378 438 */ 379 439 function get_comments_popup_template() { 380 440 $template = get_query_template( 'comments_popup', array( 'comments-popup.php' ) );