blog_id); $stylesheet_path = get_stylesheet_directory(); is_multisite() && restore_current_blog(); $located = ''; foreach ((array) $template_names as $template_name) { if ( ! $template_name) { continue; } if (file_exists($stylesheet_path . '/' . $template_name)) { $located = $stylesheet_path . '/' . $template_name; break; } elseif (file_exists(get_template_directory() . '/' . $template_name)) { $located = get_template_directory() . '/' . $template_name; break; } elseif (file_exists(ABSPATH . WPINC . '/theme-compat/' . $template_name)) { $located = ABSPATH . WPINC . '/theme-compat/' . $template_name; break; } } if ($load && '' !== $located) { load_template($located, $use_require_once); } return $located; } /** * Check if an alternative view exists and override * * @param string $original_path The original path of the view. * @param string $view View path. * @return string The new path. */ public function view_override($original_path, $view) { $found = $this->custom_locate_template("wp-ultimo/$view.php"); return $found ?: $original_path; } }