searchwp\extensions
Da: 4.0.0
Indice
Registra un'estensione da utilizzare in SearchWP, specificamente nel menu Estensioni dell'interfaccia utente delle impostazioni di SearchWP.
Parametri
| Tipo | Parametro | Predefinito | Da |
|---|---|---|---|
| Array | $extensions |
[] |
4.0.0 |
Esempi
All hooks should be added to your custom SearchWP Customizations Plugin.
Aggiungi estensione personalizzata all'interfaccia utente delle impostazioni
Classe starter per implementare un'estensione personalizzata che ha un link nel menu a discesa Estensioni della schermata delle impostazioni di SearchWP e una vista associata quando si fa clic su quel link.
| <?php | |
| // Add custom SearchWP Extension to Extensions dropdown in settings UI. | |
| // SearchWP Extensions must be a class that starts with "SearchWP" | |
| // immediately followed by your unique class name. | |
| class SearchWPMyExtension { | |
| function __construct() { | |
| add_filter( 'searchwp\extensions', function( $extensions ) { | |
| // Following the class name rule, the array key is your unique | |
| // class name _excluding_ the required "SearchWP" prefix. | |
| $extensions['MyExtension'] = __FILE__; | |
| return $extensions; | |
| } ); | |
| } | |
| // Render Extension view. | |
| function view() { | |
| ?> | |
| <h3>My Extension</h3> | |
| <?php | |
| } | |
| } | |
| new MySearchWPExtension(); |

