Created
June 6, 2017 13:21
-
-
Save jchristopher/0256f9c6766b21ebd5d74b01b0f032e3 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// // ***** UNCOMMENT THIS IF YOU WANT TO USE SHORTCODES IN WIDGETS | |
// add_filter( 'widget_text', 'do_shortcode' ); | |
// Output a SearchWP Engines dropdown | |
function my_searchwp_shortcodes_inject_engines() { ?> | |
<p class="searchwp-shortcodes-engines"> | |
<?php | |
$engines = SWP()->settings['engines']; | |
$current_engine = isset( $_GET['swpengine'] ) ? esc_attr( $_GET['swpengine'] ) : 'default'; | |
?> | |
<select name="swpengine" id="swpengine"> | |
<?php foreach ( $engines as $engine => $engine_settings ) : ?> | |
<option value="<?php echo esc_attr( $engine ); ?>" | |
<?php selected( $current_engine, $engine ); ?>> | |
<?php echo isset( $engine_settings['searchwp_engine_label'] ) ? esc_html( $engine_settings['searchwp_engine_label'] ) : 'Default'; ?> | |
</option> | |
<?php endforeach; ?> | |
</select> | |
</p><?php | |
} | |
add_action( 'searchwp_shortcodes_after_input', 'my_searchwp_shortcodes_inject_engines' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment