Created
August 21, 2020 15:56
-
-
Save stoffl6781/230eb56aef9479b8bfd7fcbace14bf4e to your computer and use it in GitHub Desktop.
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' , 'me_custom_product_searchform' ); | |
/** | |
* Filter WooCommerce Search Field | |
* | |
*/ | |
function me_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">' . __( 'Search for:', 'woocommerce' ) . '</label> | |
<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'My Search form', '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
How to translate the placeholder "search for Products..." Placeholder in WooCommerce