HUSKY - Product Filter for WooCommerce

woof_template_part

Pozwala na zmianę szablonu w locie w shortcode [woof_products]

 

Od v.1.1.8/2.1.8

 

Parametry

$template (string) — nazwa szablonu ('product' domyślnie)

Plik źródłowy

index.php

Przykład kodu


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

Uwagi dotyczące użycia

  • Dodaj ten kod do pliku functions.php Twojego motywu lub do własnej wtyczki.
  • Hook jest stosowany podczas procesu filtrowania — zmiany wchodzą w życie natychmiast.
  • Zawsze zwracaj oczekiwany typ wartości z funkcji zwrotnej.