-
-
Save searchwpgists/2edb7b91013c0d428ad920b3d27055b1 to your computer and use it in GitHub Desktop.
Add custom SearchWP Extension to Extensions dropdown in settings UI
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment