diff --git a/wp-includes/template-loader.php b/wp-includes/template-loader.php index 9911bb272..7c72a05e1 100644 --- a/wp-includes/template-loader.php +++ b/wp-includes/template-loader.php @@ -23,6 +23,7 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) : if ( is_404() && $template = get_404_template() ) : elseif ( is_search() && $template = get_search_template() ) : elseif ( is_tax() && $template = get_taxonomy_template() ) : + elseif ( is_front_page() && $template = get_front_page_template() ) : elseif ( is_home() && $template = get_home_template() ) : elseif ( is_attachment() && $template = get_attachment_template() ) : remove_filter('the_content', 'prepend_attachment'); @@ -43,4 +44,4 @@ if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) : return; endif; -?> \ No newline at end of file +?> diff --git a/wp-includes/theme.php b/wp-includes/theme.php index b312caba5..608d2ed11 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -844,7 +844,9 @@ function get_date_template() { /** * Retrieve path of home template in current or parent template. - * + * + * This is the template used for the page containing the blog posts + * * Attempts to locate 'home.php' first before falling back to 'index.php'. * * @since 1.5.0 @@ -857,6 +859,22 @@ function get_home_template() { return apply_filters('home_template', $template); } +/** + * Retrieve path of front-page template in current or parent template. + * + * Looks for 'front-page.php'. + * + * @since 3.0.0 + * @uses apply_filters() Calls 'front_page_template' on file path of template. + * + * @return string + */ +function get_front_page_template() { + global $wp_query; + + return apply_filters( 'front_page_template', locate_template( array('front-page.php') ) ); +} + /** * Retrieve path of page template in current or parent template. * @@ -1001,6 +1019,8 @@ function locate_template($template_names, $load = false, $require_once = true ) $located = ''; foreach ( $template_names as $template_name ) { + if ( !$template_name ) + continue; if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { $located = STYLESHEETPATH . '/' . $template_name; break;