searchwp\source\attribute\label
Da: 4.0.0
Indice
Personalizza l'etichetta dell'attributo della sorgente
Parametri
| Tipo | Parametro | Predefinito | Da | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Stringa | $label |
Etichetta definita | 4.0.0 |
|||||||||
| Array |
$args
|
4.0.0 |
||||||||||
Esempi
All hooks should be added to your custom SearchWP Customizations Plugin.
Personalizza l'etichetta dell'attributo Commenti per il tipo di post personalizzato Prodotti
Molti plugin per l'e-commerce (ad es. WooCommerce) utilizzano i Commenti per memorizzare le Recensioni dei Prodotti. Questo snippet modifica l'etichetta di Commenti in Recensioni.
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 ); |

