woof_before_term_name
Utilisé dans les types HTML comme : radio, checkbox, select, mselect pour afficher des symboles ou icônes avant leur étiquette
wp-content\plugins\woocommerce-products-filter\views\html_types\checkbox.php
Paramètres
$term (string) — the term name, $taxonomy_info (array) — taxonomy data
Fichier source
views/html_types/checkbox.php, radio.php, select.php
Exemple de code
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);
Notes d'utilisation
- Ajoutez ce code au fichier
functions.phpde votre thème ou à un plugin personnalisé. - Le hook est appliqué pendant le processus de filtrage — les modifications prennent effet immédiatement.
- Retournez toujours le type de valeur attendu depuis la fonction de rappel.
