HUSKY - Products Filter Professional for WooCommerce

woof-template-part

woof_template_part

[woof_products]ショートコードで商品を表示するために使用されるテンプレートパーツの名前を変更できます。

パラメーター

$template (string) — テンプレート名 ('product'がデフォルト)

ソースファイル

index.php

コード例

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;
});

使用上の注意

  • このコードをテーマのfunctions.phpファイルまたはカスタムプラグインに追加してください。
  • このフックはフィルタリングプロセス中に適用され — 変更はすぐに有効になります。
  • 常にコールバック関数から期待される値の型を返してください。