Ticket #18561: 18561.get_template_part_slug.patch
| File 18561.get_template_part_slug.patch, 1.4 KB (added by SergeyBiryukov, 9 months ago) |
|---|
-
wp-includes/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}' and "get_template_part_{$slug}_after" actions. 115 115 * 116 116 * @param string $slug The slug name for the generic template. 117 117 * @param string $name The name of the specialised template. … … 126 126 $templates[] = "{$slug}.php"; 127 127 128 128 locate_template($templates, true, false); 129 130 do_action( "get_template_part_{$slug}_after", $slug, $name ); 129 131 } 130 132 131 133 /** 134 * Determine the actual template part slug used by current theme 135 * 136 * Makes it easy for a plugin to hook into "get_template_part_{$slug}" or 137 * "get_template_part_{$slug}_after". 138 * 139 * @since 3.3.0 140 * @uses get_theme_support() 141 * 142 * @param string $slug The slug name for the generic template. 143 */ 144 function get_template_part_slug( $slug ) { 145 if ( ! current_theme_supports( 'template-parts' ) ) 146 return false; 147 148 $template_parts = get_theme_support( 'template-parts' ); 149 150 if ( isset( $template_parts[0][$slug] ) ) 151 return $template_parts[0][$slug]; 152 153 return false; 154 } 155 156 /** 132 157 * Display search form. 133 158 * 134 159 * Will first attempt to locate the searchform.php file in either the child or
