woof_template_part
Changes the template on the fly in the shortcode [woof_products]
From v.1.1.8/2.1.8
Parameters
$template (string) — the template name ('product' by default)
Source File
index.php
Code Example
add_filter('woof_template_part', function($template) {
// Use a custom template for products display
// Place your template at: wp-content/themes/your-theme/woof/product-custom.php
$custom_template = 'product-custom';
if (is_product_category('specials')) {
return $custom_template;
}
return $template;
});
Usage Notes
- Add this code to your theme's
functions.phpfile or a custom plugin. - The hook is applied during the filtering process — changes take effect immediately.
- Always return the expected value type from the callback function.
