get_template_dir_paths(); foreach ($template_dir_paths as $template_dir_path) { $template_path = $template_dir_path . $template_name; $template_path = apply_filters("aff_locate_template", $template_path, $template_name, $template_dir_path); if (file_exists($template_path)) { $template_path = apply_filters("aff_located_template", $template_path, $template_name, $template_dir_path); return $template_path; } } } // Template not found. return null; } /** * Get a list of all available template directory path locations. * * Default paths: * 'aff-templates' dir in the child theme. * 'aff-templates' dir in the parent theme. * 'templates' dir in the Affilicious plugin. * * You can add new paths with the "aff_template_paths" filter. * * @since 0.9.5 * @return string[] */ public function get_template_dir_paths() { $file_paths = [ trailingslashit(get_stylesheet_directory()) . 'aff-templates', trailingslashit(get_template_directory()) . 'aff-templates', trailingslashit(AFFILICIOUS_ROOT_PATH) . 'templates', ]; $file_paths = apply_filters('aff_template_paths', $file_paths); Assert_Helper::all_is_type_of($file_paths, 'string', __METHOD__, 'Every template path has to be a string. Got: %s', '0.9.5'); // Finalize the paths with a trailing slash. $file_paths = array_map('trailingslashit', $file_paths); return $file_paths; } }