Ticket #13691: get_template_part.2.diff
File get_template_part.2.diff, 1.1 KB (added by , 15 years ago) |
---|
-
general-template.php
111 111 * 112 112 * @uses locate_template() 113 113 * @since 3.0.0 114 * @uses do_action() Calls 'get_template_part {$slug}' action.114 * @uses do_action() Calls 'get_template_part_{$slug}' action. 115 115 * 116 116 * @param string $slug The slug name for the generic template. 117 * @param string $name The name of the specialised template.117 * @param mixed $names The names of the specialised templates (it can be a string, or an array of names to search for in priority order.). 118 118 */ 119 function get_template_part( $slug, $name = null) {120 do_action( "get_template_part_{$slug}", $slug, $name );121 119 function get_template_part( $slug, $names = array() ) { 120 do_action( "get_template_part_{$slug}", $slug, $names ); 121 122 122 $templates = array(); 123 if ( isset($name) )123 foreach ( (array)$names as $name ) { 124 124 $templates[] = "{$slug}-{$name}.php"; 125 125 } 126 126 $templates[] = "{$slug}.php"; 127 127 128 128 locate_template($templates, true, false);