get_page_template [ WordPress Function ]
get_page_template ( No parameters )
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: get_page_templates, get_paged_template, get_tag_template, get_date_template, get_page_template_slug
Retrieve path of page template in current or parent template.
Will first look for the specifically assigned page template The will search for 'page-{slug}.php' followed by 'page-id.php' and finally 'page.php'
Source
<?php
function get_page_template() {
$id = get_queried_object_id();
$template = get_page_template_slug();
$pagename = get_query_var('pagename');
if ( ! $pagename && $id ) {
// If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
$post = get_queried_object();
$pagename = $post->post_name;
}
$templates = array();
if ( $template && 0 === validate_file( $template ) )
$templates[] = $template;
if ( $pagename )
$templates[] = "page-$pagename.php";
if ( $id )
$templates[] = "page-$id.php";
$templates[] = 'page.php';
return get_query_template( 'page', $templates );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/get page template « WordPress Codex
Description. Retrieve path of page template in current or parent template. First attempt is to look for the file in the '_wp_page_template' page meta data.
codex.wordpress.org - get_page_template (WordPress Function) - WPSeek.com
WordPress lookup for get_page_template, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - WP Question: How to get page template name? | ThemeForest ...
Hi guys I run into a problem I want to list only pages that are created from template “Portfolio Template”. So my question is how can I check ...
themeforest.net - get_page_template() WordPress function reference, arguments and ...
get_page_template(). Retrieve path of page template in current or parent template. Will first look for the specifically assigned page template The will search for ...
queryposts.com