WordPress.org

Make WordPress Core

Ticket #18480: general-template.patch

File general-template.patch, 1.5 KB (added by gxxaxx, 4 years ago)

proper patch version of the file.

  • general-template.php

     
    7070 * Includes the sidebar template for a theme or if a name is specified then a 
    7171 * specialised sidebar will be included. 
    7272 * 
    73  * For the parameter, if the file is called "sidebar-special.php" then specify 
    74  * "special". 
     73 * The parameter maybe a simple text string such as: 
     74 *              For the parameter, if the file is called "sidebar-special.php" then specify 
     75 *              "special". 
    7576 * 
     77 * Or, the parameter maybe an array of strings such as: ("mefirst", "mesecond", "special") 
     78 *      In this case the sidebar search order would be:  
     79 *              "sidebar-mefirst.php" 
     80 *              "sidebar-mesecond.php" 
     81 *              "sidebar-special.php" 
     82 *    
    7683 * @uses locate_template() 
    7784 * @since 1.5.0 
    7885 * @uses do_action() Calls 'get_sidebar' action. 
     
    8390        do_action( 'get_sidebar', $name ); 
    8491 
    8592        $templates = array(); 
    86         if ( isset($name) ) 
    87                 $templates[] = "sidebar-{$name}.php"; 
    8893 
     94        if ( isset($name) ) { 
     95                if (is_array($name)) { 
     96                        foreach ( (array) $name as $disname ) { 
     97                                if ( !$disname ) { continue; } 
     98                                $templates[] = "sidebar-{$disname}.php"; 
     99                        } 
     100                } else { 
     101                        $templates[] = "sidebar-{$name}.php"; 
     102                } 
     103        } 
     104 
    89105        $templates[] = 'sidebar.php'; 
    90106 
    91107        // Backward compat code will be removed in a future release 
     
    93109                load_template( ABSPATH . WPINC . '/theme-compat/sidebar.php'); 
    94110} 
    95111 
     112 
    96113/** 
    97114 * Load a template part into a template 
    98115 *