Archived topic
Tag in search form
4 replies · Started by Pedro on September 16, 2018
Viewing posts 1–5 of 5
Hello. I'm using the generatepress search bar in my site and when I search for a label, search returns no results.
I'm using this code to display only 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="%2$s">
<input type="hidden" name="post_type" value="product">
</form>',
esc_url( home_url( '/' ) ),
esc_attr( get_search_query() ),
esc_attr_x( 'Search', 'label', 'generatepress' )
);
}
I'm also using WC Marketplace plugin
Hi there,
Can you try #1 here to eliminate any plugin conflicts first?
https://docs.generatepress.com/article/debugging-tips/
Let me know :)
Already done, but not solved anything.
Solved with this code:
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="%2$s">
<input type="hidden" name="search_id" value="default">
<input type="hidden" name="post_type" value="product">
</form>',
esc_url( home_url( '/' ) ),
esc_attr( get_search_query() ),
esc_attr_x( 'Search', 'label', 'generatepress' )
);
}
Awesome. Thanks for sharing!
This archived topic is closed to new replies.