Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Last active February 3, 2017 08:17
Show Gist options
  • Save rynaldos-zz/bc3b3a06c89d3a19b5ce4a7473369de4 to your computer and use it in GitHub Desktop.
Save rynaldos-zz/bc3b3a06c89d3a19b5ce4a7473369de4 to your computer and use it in GitHub Desktop.
[WooCommerce] Replace the default (WC) search widget placeholder
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">' . __( 'Search for:', 'woocommerce' ) . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'Zoek opleidingen', '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