Index: wp-includes/template.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1250
===================================================================
--- wp-includes/template.php	(revision 66db22da1931cc22bc497014db1d15c2441cd5b3)
+++ wp-includes/template.php	(revision )
@@ -401,15 +401,20 @@
  */
 function locate_template($template_names, $load = false, $require_once = true ) {
 	$located = '';
+
+	$dirs = apply_filters('template_dirs', array(10 => STYLESHEETPATH, 20 => TEMPLATEPATH), $template_names);
+
+	ksort($dirs);
+
 	foreach ( (array) $template_names as $template_name ) {
 		if ( !$template_name )
 			continue;
-		if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
-			$located = STYLESHEETPATH . '/' . $template_name;
+
+		foreach($dirs AS $dir){
+			if ( file_exists($dir . '/' . $template_name)) {
+				$located = $dir . '/' . $template_name;
-			break;
+				break;
-		} else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
-			$located = TEMPLATEPATH . '/' . $template_name;
-			break;
+			}
 		}
 	}
 
