[Resolved] Tag in search form

Home Forums Support [Resolved] Tag in search form

Home Forums Support Tag in search form

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #678428
    Pedro

    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

    GP Premium 1.7.2
    #678624
    Leo
    Staff
    Customer Support

    Hi there,

    Can you try #1 here to eliminate any plugin conflicts first?
    https://docs.generatepress.com/article/debugging-tips/

    Let me know 🙂

    #678726
    Pedro

    Already done, but not solved anything.

    #678771
    Pedro

    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' )
    	);
    }
    #678800
    Leo
    Staff
    Customer Support

    Awesome. Thanks for sharing!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.