searchwp\source\attribute\label
Seit: 4.0.0
Label des Quellattributs anpassen
Parameter
| Typ | Parameter | Standard | Seit | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Zeichenkette | $label |
Definiertes Label | 4.0.0 |
|||||||||
| Array |
$args
|
4.0.0 |
||||||||||
Beispiele
All hooks should be added to your custom SearchWP Customizations Plugin.
Kommentare-Attribut-Label für den benutzerdefinierten Beitragstyp Produkte anpassen
Viele E-Commerce-Plugins (z. B. WooCommerce) verwenden Kommentare, um Produktbewertungen zu speichern. Dieser Ausschnitt ändert das Label für Kommentare in Bewertungen.
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 ); |

