Make WordPress Core

Changeset 8673


Ignore:
Timestamp:
08/19/2008 08:57:48 PM (18 years ago)
Author:
ryan
Message:

Support named headers and footers in get_footer() and get_header(). Props AaronCampbell. fixes #7549 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r8624 r8673  
    33/* Note: these tags go anywhere in the template */
    44
    5 function get_header() {
     5function get_header( $name = null ) {
    66    do_action( 'get_header' );
    7     if ('' == locate_template(array('header.php'), true))
     7
     8    $templates = array();
     9    if ( isset($name) )
     10        $templates[] = "header-{$name}.php";
     11
     12    $templates[] = "header.php";
     13
     14    if ('' == locate_template($templates, true))
    815        load_template( get_theme_root() . '/default/header.php');
    916}
    1017
    1118
    12 function get_footer() {
     19function get_footer( $name = null ) {
    1320    do_action( 'get_footer' );
    14     if ('' == locate_template(array('footer.php'), true))
     21
     22    $templates = array();
     23    if ( isset($name) )
     24        $templates[] = "footer-{$name}.php";
     25
     26    $templates[] = "footer.php";
     27
     28    if ('' == locate_template($templates, true))
    1529        load_template( get_theme_root() . '/default/footer.php');
    1630}
     
    1933function get_sidebar( $name = null ) {
    2034    do_action( 'get_sidebar' );
    21    
     35
    2236    $templates = array();
    2337    if ( isset($name) )
    2438        $templates[] = "sidebar-{$name}.php";
    25    
     39
    2640    $templates[] = "sidebar.php";
    27    
     41
    2842    if ('' == locate_template($templates, true))
    2943        load_template( get_theme_root() . '/default/sidebar.php');
Note: See TracChangeset for help on using the changeset viewer.