HUSKY - Product Filter for WooCommerce

woof_set_shortcode_taxonomyattr_behaviour

Bu kanca, eklentinin index.php dosyasındaki public function woof_shortcode işlevinde çalışır ve ‘additional_taxes‘ özniteliğini manipüle eder.

Parametreler

$taxonomies_string (string) — the taxonomies string from the shortcode attribute

Kaynak Dosya

index.php

Kod Örneği


add_filter('woof_set_shortcode_taxonomyattr_behaviour', function($taxonomies_string) {
    // Force specific taxonomy to always be included
    $additional = 'product_tag:featured,on_sale';
    if (!empty($taxonomies_string)) {
        $taxonomies_string .= '+' . $additional;
    } else {
        $taxonomies_string = $additional;
    }
    return $taxonomies_string;
});

Kullanım Notları

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