generate_navigation_search_output

The generate_navigation_search_output filter allows you to change the HTML markup of your navigation search form.

Usage

For example, if we want our navigation search form to search WooCommerce products:

add_filter( 'generate_navigation_search_output', 'tu_wc_navigation_search' );
function tu_wc_navigation_search() {
	printf( 
		'<form method="get" class="search-form navigation-search" action="%1$s">
			<input type="search" class="search-field" value="%2$s" name="s" title="%3$s" />
			<input type="hidden" name="post_type" value="products" />
		</form>',
		esc_url( home_url( '/' ) ),
		esc_attr( get_search_query() ),
		esc_attr_x( 'Search', 'label', 'generatepress' )
	);
}

Or, if you want to add a placeholder to the input:

add_filter( 'generate_navigation_search_output', 'tu_navigation_search_placeholder' );
function tu_navigation_search_placeholder() {
	printf( 
		'<form method="get" class="search-form navigation-search" action="%1$s">
			<input type="search" placeholder="Enter your search" class="search-field" value="%2$s" name="s" title="%3$s" />
		</form>',
		esc_url( home_url( '/' ) ),
		esc_attr( get_search_query() ),
		esc_attr_x( 'Search', 'label', 'generatepress' )
	);
}