HUSKY - Product Filter for WooCommerce

woof_husky_txt_templates

Filters the file path for a Husky text search result template when the default template file does not exist inside the plugin, allowing custom template locations.

Parameters

$template (string) — The sanitized template key (e.g. 'default') to be used for locating a custom template file

Source File

ext/by_text/index.php:1033

Code Example


add_filter('woof_husky_txt_templates', function($template) {
    $custom_path = get_stylesheet_directory() . '/woof/search-templates/' . $template . '.php';
    return file_exists($custom_path) ? $custom_path : '';
});

Usage Notes

  • Called only when the default template file does not exist in the plugin's views/templates directory.
  • If the filter returns a path that does not exist, it falls through to the theme's woof/ext/by_text/views/templates/ directory.
  • The template value is sanitized via sanitize_key() before use.