HUSKY - Product Filter for WooCommerce

woof_before_term_name

Uses in html types as: radio, checkbox, select, mselect for printing any symbols or icons before its label

wp-content\plugins\woocommerce-products-filter\views\html_types\checkbox.php

 

Parameter

$term (string) — the term name, $taxonomy_info (array) — taxonomy data

Quelldatei

views/html_types/checkbox.php, radio.php, select.php

Codebeispiel


add_filter('woof_before_term_name', function($term, $taxonomy_info) {
    // Add a custom icon or badge before the term name
    $icon = '';
    if (isset($taxonomy_info->taxonomy) && $taxonomy_info->taxonomy === 'product_cat') {
        $icon = '📁 ';
    }
    return $icon . $term;
}, 10, 2);

Verwendungshinweise

  • Fügen Sie diesen Code in die functions.php Datei Ihres Themes oder in ein benutzerdefiniertes Plugin ein.
  • Der Hook wird während des Filtervorgangs angewendet — Änderungen werden sofort wirksam.
  • Geben Sie stets den erwarteten Wertetyp aus der Callback-Funktion zurück.