-
-
Save hirejordansmith/c8d41a23f6538817e1d2b7db321ace57 to your computer and use it in GitHub Desktop.
How to modify the WooCommerce Product Search Form
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
add_filter( 'get_product_search_form' , 'woo_custom_product_searchform' ); | |
function woo_custom_product_searchform( $form ) { | |
$form = '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/' ) ) . '"> | |
<div> | |
<label class="screen-reader-text" for="s">' . __( 'Enter Keyword or Product Number', 'woocommerce' ) . '</label> | |
<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'Enter Keyword or Product Number', 'woocommerce' ) . '" /> | |
<input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search', 'woocommerce' ) .'" /> | |
<input type="hidden" name="post_type" value="product" /> | |
</div> | |
</form>'; | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment