Introduce a template file for the Front Page of a site. Has priority over every other template which applies and falls back to the standard template flow for the page / list of posts.
Fixes #6801 git-svn-id: http://svn.automattic.com/wordpress/trunk@14276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0fd5fee450
commit
033aac697c
|
@ -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;
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue