Ticket #18567: general-template.php.diff
| File general-template.php.diff, 1.3 KB (added by , 15 years ago) |
|---|
-
wp-includes/general-template.php
109 109 * For the parameter, if the file is called "{slug}-special.php" then specify 110 110 * "special". 111 111 * 112 * For the $sub_folder parameter, specifiy only the sub folder name containing the 113 * template parts. Don't include the full path to the sub folder. 114 * 112 115 * @uses locate_template() 113 116 * @since 3.0.0 114 117 * @uses do_action() Calls 'get_template_part{$slug}' action. 115 118 * 116 119 * @param string $slug The slug name for the generic template. 117 120 * @param string $name The name of the specialised template. 121 * @param string $sub_folder The sub folder location containing the template. 118 122 */ 119 function get_template_part( $slug, $name = null ) {123 function get_template_part( $slug, $name = null, $sub_folder = null ) { 120 124 do_action( "get_template_part_{$slug}", $slug, $name ); 121 125 122 126 $templates = array(); 123 127 if ( isset($name) ) 124 $templates[] = "{$slug}-{$name}.php";128 $templates[] = trailingslashit( $sub_folder )."{$slug}-{$name}.php"; 125 129 126 $templates[] = "{$slug}.php";130 $templates[] = trailingslashit( $sub_folder )."{$slug}.php"; 127 131 128 132 locate_template($templates, true, false); 129 133 }