関数 get_page_template()
2014/12/17
関数 get_page_template()
定義ファイル :/blog/wp-includes/template.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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(); if ( $post ) $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 ); } |