HUSKY - Product Filter for WooCommerce

woof_template_part

Kısa kod [woof_products] içinde şablonu anında değiştirir

 

v.1.1.8/2.1.8 sürümünden itibaren

 

Parametreler

$template (string) — the template name ('product' by default)

Kaynak Dosya

index.php

Kod Örneği


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

Kullanım Notları

  • Bu kodu temanızın functions.php dosyasına veya özel bir eklentiye ekleyin.
  • Hook, filtreleme işlemi sırasında uygulanır — değişiklikler anında etkili olur.
  • Geri çağırma fonksiyonundan her zaman beklenen değer türünü döndürün.