Last active
April 14, 2020 07:30
-
-
Save generatepress/1004ec856a3d7a8023b6 to your computer and use it in GitHub Desktop.
Replace navigation search with a woocommerce navigation search
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
if ( ! function_exists( 'generate_navigation_search' ) ) : | |
/** | |
* Add the search bar to the navigation | |
* @since 1.1.4 | |
*/ | |
add_action( 'generate_inside_navigation','generate_navigation_search'); | |
function generate_navigation_search() | |
{ | |
$generate_settings = wp_parse_args( | |
get_option( 'generate_settings', array() ), | |
generate_get_defaults() | |
); | |
if ( 'enable' !== $generate_settings['nav_search'] ) | |
return; | |
?> | |
<form method="get" class="search-form navigation-search" action="<?php echo esc_url( home_url( '/' ) ); ?>"> | |
<input type="search" class="search-field" value="<?php echo esc_attr( get_search_query() ); ?>" name="s" title="<?php _ex( 'Search', 'label', 'generatepress' ); ?>"> | |
<input type="hidden" name="post_type" value="product" /> | |
</form> | |
<?php | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment