Skip to content

Instantly share code, notes, and snippets.

@fovoc
Last active August 29, 2015 14:05
Show Gist options
  • Save fovoc/80e095ef92ae8be4d431 to your computer and use it in GitHub Desktop.
Save fovoc/80e095ef92ae8be4d431 to your computer and use it in GitHub Desktop.
Shoestrap 3 - override navbar searchform
<?php
function my_navbar_pre_searchbox() {
global $ss_settings;
$show_searchbox = $ss_settings['navbar_search'];
if ( $show_searchbox == '1' ) : ?>
<form role="search" method="get" id="searchform" class="form-search pull-right navbar-form" action="<?php echo home_url('/'); ?>">
<label class="hide" for="s"><?php _e('Search for:', 'shoestrap'); ?></label>
<input type="text" value="<?php if (is_search()) { echo get_search_query(); } ?>" name="s" id="s" class="form-control search-query" placeholder="<?php _e('Search', 'shoestrap'); ?>">
</form>
<?php endif;
}
function change_navbar_searchform(){
global $ss_menus;
remove_action( 'shoestrap_inside_nav_begin', array( $ss_menus, 'navbar_pre_searchbox' ), 11 );
add_action( 'shoestrap_inside_nav_begin', 'my_navbar_pre_searchbox' , 12 );
}
add_action( 'init', 'change_navbar_searchform' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment