Available since: 1.0
searchwp_extensions
Many times a SearchWP Extension can run independently of SearchWP core simply by utilizing any number of available Hooks. There are other Extensions, however, that would benefit from an integration with the SearchWP core settings UI. This filter allows you to register your Extension with SearchWP’s Extensions menu on the main SearchWP settings screen.
Example: To initialize the registration of your Extension with SearchWP, add the following to your plugin:
<?php | |
class SearchWPMyExtension() { | |
function __construct() { | |
add_filter( 'searchwp_extensions', array( $this, 'register' ), 10 ); | |
} | |
function register( $extensions ) { | |
$extensions['MyExtension'] = __FILE__; | |
return $extensions; | |
} | |
} | |
new My_SearchWP_Extension(); |
Once registered, a link will be added to the SearchWP Extensions menu on the main SearchWP settings screen. You are responsible for implementing a view() method in your extension class that will be fired when your extension’s link is selected from the SearchWP Extensions menu:
<?php | |
class SearchWPMyExtension() { | |
function __construct() { | |
add_filter( 'searchwp_extensions', array( $this, 'register' ), 10 ); | |
} | |
function register( $extensions ) { | |
$extensions['MyExtension'] = __FILE__; | |
return $extensions; | |
} | |
function view() { ?> | |
<p><?php _e( "This is your Extension's view.", 'searchwpmyextension' ); ?></p> | |
<?php } | |
} | |
new My_SearchWP_Extension(); |
The rest of your extension can be implemented using any method you choose.