| | 683 | * Retrieve path of front-page template in current or parent template. |
| | 684 | * |
| | 685 | * First attempt is to look for the file in the '_wp_page_template' page meta |
| | 686 | * data. The second attempt, if the first does not have a file or it's empty, is |
| | 687 | * to look for 'front-page.php' before falling back to 'page.php' and ultimately |
| | 688 | * falling back to 'index.php' if none of these exist. |
| | 689 | * |
| | 690 | * @since 2.9.0 |
| | 691 | * @uses apply_filters() Calls 'front_page_template' on file path of template. |
| | 692 | * |
| | 693 | * @return string |
| | 694 | */ |
| | 695 | function get_front_page_template() { |
| | 696 | global $wp_query; |
| | 697 | |
| | 698 | $id = (int) $wp_query->post->ID; |
| | 699 | $template = get_post_meta($id, '_wp_page_template', true); |
| | 700 | |
| | 701 | if ( 'default' == $template ) |
| | 702 | $template = ''; |
| | 703 | |
| | 704 | $templates = array(); |
| | 705 | if ( !empty($template) && !validate_file($template) ) |
| | 706 | $templates[] = $template; |
| | 707 | |
| | 708 | $templates[] = "front-page.php"; |
| | 709 | $templates[] = "page.php"; |
| | 710 | |
| | 711 | return apply_filters('front_page_template', locate_template($templates)); |
| | 712 | } |
| | 713 | |
| | 714 | /** |