searchwp\source\attribute\label
Depuis : 4.0.0
Table des matières
Personnaliser l'étiquette d'attribut de la source
Paramètres
| Type | Paramètre | Défaut | Depuis | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chaîne | $label |
Libellé défini | 4.0.0 |
|||||||||
| Tableau |
$args
|
4.0.0 |
||||||||||
Exemples
Tous les hooks doivent être ajoutés à votre plugin personnalisé SearchWP Customizations Plugin.
Personnaliser le libellé de l'attribut Commentaires pour le type de publication personnalisé Produits
De nombreux plugins e-commerce (par exemple WooCommerce) utilisent les Commentaires pour stocker les Avis sur les produits. Cet extrait modifie le libellé de Commentaires en Avis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Customize Comments Attribute label for Products custom post type in SearchWP. | |
| add_filter( 'searchwp\source\attribute\label', function( $label ) { | |
| if ( 'post.product' === $args['source'] && 'comments' === $args['attribute'] ) { | |
| return 'Reviews'; | |
| } else { | |
| return $label; | |
| } | |
| }, 20, 2 ); |
