From 122abf2fa81cc4514386dabd0eba51b0f96ef7ff Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 18 Apr 2010 11:50:48 +0000 Subject: [PATCH] Fix page-.php templates for static front pages. See #12907 git-svn-id: https://develop.svn.wordpress.org/trunk@14152 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/theme.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 74ff7cc9c1..04fa3ca8af 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -875,6 +875,12 @@ function get_page_template() { $template = get_post_meta($id, '_wp_page_template', true); $pagename = get_query_var('pagename'); + if ( !$pagename && $id > 0 ) { + // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object + $post = $wp_query->get_queried_object(); + $pagename = $post->post_name; + } + if ( 'default' == $template ) $template = '';