searchwp\extensions
4.0.0以降
SearchWPで使用される拡張機能を登録します。特にSearchWP設定UIの拡張機能メニューで使用されます。
パラメータ
| タイプ | パラメータ | デフォルト | 提供開始 |
|---|---|---|---|
| 配列 | $extensions |
[] |
4.0.0 |
例
All hooks should be added to your custom SearchWP Customizations Plugin.
カスタム拡張機能を設定UIに追加
SearchWP設定画面の拡張機能ドロップダウンにリンクがあり、そのリンクがクリックされたときに表示されるビューを持つカスタム拡張機能を実装するためのスターター クラス。
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 | |
| // 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(); |

