woof_template_part
woof_template_part
Позволяет изменить название шаблонной части, используемой для отображения товаров в шорткоде [woof_products].
Parameters
$template (string) — название шаблона ('product' по умолчанию)
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.