[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
Template loading functions.
File Size: | 774 lines (22 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
get_query_template( $type, $templates = array() X-Ref |
Retrieve path to a template Used to quickly retrieve the path of a template without including the file extension. It will also check the parent theme, if the file exists, with the use of locate_template(). Allows for more generic template location without the use of the other get_*_template() functions. since: 1.5.0 param: string $type Filename without extension. param: string[] $templates An optional list of template candidates. return: string Full path to template file. |
get_index_template() X-Ref |
Retrieve path of index template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'index'. since: 3.0.0 return: string Full path to index template file. |
get_404_template() X-Ref |
Retrieve path of 404 template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is '404'. since: 1.5.0 return: string Full path to 404 template file. |
get_archive_template() X-Ref |
Retrieve path of archive template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'archive'. since: 1.5.0 return: string Full path to archive template file. |
get_post_type_archive_template() X-Ref |
Retrieve path of post type archive template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'archive'. since: 3.7.0 return: string Full path to archive template file. |
get_author_template() X-Ref |
Retrieve path of author template in current or parent template. The hierarchy for this template looks like: 1. author-{nicename}.php 2. author-{id}.php 3. author.php An example of this is: 1. author-john.php 2. author-1.php 3. author.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'author'. since: 1.5.0 return: string Full path to author template file. |
get_category_template() X-Ref |
Retrieve path of category template in current or parent template. The hierarchy for this template looks like: 1. category-{slug}.php 2. category-{id}.php 3. category.php An example of this is: 1. category-news.php 2. category-2.php 3. category.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'category'. since: 1.5.0 since: 4.7.0 The decoded form of `category-{slug}.php` was added to the top of the return: string Full path to category template file. |
get_tag_template() X-Ref |
Retrieve path of tag template in current or parent template. The hierarchy for this template looks like: 1. tag-{slug}.php 2. tag-{id}.php 3. tag.php An example of this is: 1. tag-wordpress.php 2. tag-3.php 3. tag.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'tag'. since: 2.3.0 since: 4.7.0 The decoded form of `tag-{slug}.php` was added to the top of the return: string Full path to tag template file. |
get_taxonomy_template() X-Ref |
Retrieve path of custom taxonomy term template in current or parent template. The hierarchy for this template looks like: 1. taxonomy-{taxonomy_slug}-{term_slug}.php 2. taxonomy-{taxonomy_slug}.php 3. taxonomy.php An example of this is: 1. taxonomy-location-texas.php 2. taxonomy-location.php 3. taxonomy.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'taxonomy'. since: 2.5.0 since: 4.7.0 The decoded form of `taxonomy-{taxonomy_slug}-{term_slug}.php` was added to the top of the return: string Full path to custom taxonomy term template file. |
get_date_template() X-Ref |
Retrieve path of date template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'date'. since: 1.5.0 return: string Full path to date template file. |
get_home_template() X-Ref |
Retrieve path of home template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'home'. since: 1.5.0 return: string Full path to home template file. |
get_front_page_template() X-Ref |
Retrieve path of front page template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'frontpage'. since: 3.0.0 return: string Full path to front page template file. |
get_privacy_policy_template() X-Ref |
Retrieve path of Privacy Policy page template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'privacypolicy'. since: 5.2.0 return: string Full path to privacy policy template file. |
get_page_template() X-Ref |
Retrieve path of page template in current or parent template. The hierarchy for this template looks like: 1. {Page Template}.php 2. page-{page_name}.php 3. page-{id}.php 4. page.php An example of this is: 1. page-templates/full-width.php 2. page-about.php 3. page-4.php 4. page.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'page'. since: 1.5.0 since: 4.7.0 The decoded form of `page-{page_name}.php` was added to the top of the return: string Full path to page template file. |
get_search_template() X-Ref |
Retrieve path of search template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'search'. since: 1.5.0 return: string Full path to search template file. |
get_single_template() X-Ref |
Retrieve path of single template in current or parent template. Applies to single Posts, single Attachments, and single custom post types. The hierarchy for this template looks like: 1. {Post Type Template}.php 2. single-{post_type}-{post_name}.php 3. single-{post_type}.php 4. single.php An example of this is: 1. templates/full-width.php 2. single-post-hello-world.php 3. single-post.php 4. single.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'single'. since: 1.5.0 since: 4.4.0 `single-{post_type}-{post_name}.php` was added to the top of the template hierarchy. since: 4.7.0 The decoded form of `single-{post_type}-{post_name}.php` was added to the top of the since: 4.7.0 `{Post Type Template}.php` was added to the top of the template hierarchy. return: string Full path to single template file. |
get_embed_template() X-Ref |
Retrieves an embed template path in the current or parent template. The hierarchy for this template looks like: 1. embed-{post_type}-{post_format}.php 2. embed-{post_type}.php 3. embed.php An example of this is: 1. embed-post-audio.php 2. embed-post.php 3. embed.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'embed'. since: 4.5.0 return: string Full path to embed template file. |
get_singular_template() X-Ref |
Retrieves the path of the singular template in current or parent template. The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'singular'. since: 4.3.0 return: string Full path to singular template file |
get_attachment_template() X-Ref |
Retrieve path of attachment template in current or parent template. The hierarchy for this template looks like: 1. {mime_type}-{sub_type}.php 2. {sub_type}.php 3. {mime_type}.php 4. attachment.php An example of this is: 1. image-jpeg.php 2. jpeg.php 3. image.php 4. attachment.php The template hierarchy and template path are filterable via the {@see '$type_template_hierarchy'} and {@see '$type_template'} dynamic hooks, where `$type` is 'attachment'. since: 2.0.0 since: 4.3.0 The order of the mime type logic was reversed so the hierarchy is more logical. return: string Full path to attachment template file. |
locate_template( $template_names, $load = false, $require_once = true, $args = array() X-Ref |
Retrieve the name of the highest priority template file that exists. Searches in the STYLESHEETPATH before TEMPLATEPATH and wp-includes/theme-compat so that themes which inherit from a parent theme can just overload one file. since: 2.7.0 since: 5.5.0 The `$args` parameter was added. param: string|array $template_names Template file(s) to search for, in order. param: bool $load If true the template file will be loaded if it is found. param: bool $require_once Whether to require_once or require. Has no effect if `$load` is false. param: array $args Optional. Additional arguments passed to the template. return: string The template filename if one is located. |
load_template( $_template_file, $require_once = true, $args = array() X-Ref |
Require the template file with WordPress environment. The globals are set up for the template file to ensure that the WordPress environment is available from within the function. The query variables are also available. since: 1.5.0 since: 5.5.0 The `$args` parameter was added. param: string $_template_file Path to template file. param: bool $require_once Whether to require_once or require. Default true. param: array $args Optional. Additional arguments passed to the template. |
Generated: Sat Dec 7 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |