wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
get_page_template [ WordPress Function ]
| Gibt zurück: |
|
| Definiert in: |
|
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 );
}
?>
Beispiele [ wp-snippets.com ]
Top Google Suchergebnisse
- 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 ...
1933 posts. Has been a member for 3-4 years; Won a Competition; Contributed a Blog Post; Author had a File in an Envato Bundle; Was ...
themeforest.net - How to get the current page name in Wordpress - Stack Overflow
$pagename is defined in the file wp-includes/theme.php, inside the function get_page_template() , which is of course called before your page ...
stackoverflow.com