This is my site's woocommerce product page http://ift.tt/1OpZOmy As you can see, I use two search: The first above contact menu item and the second one in sidebar. First search is a template default search and the second one is woocommerce product search widget.
My aim is to limit character numbers in both search. I have this code in woocommerce product search widget and it works good. Just try to search with less then 17 characters and you will see what I mean:
<form role="search" method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label class="screen-reader-text" for="s"><?php _e( '', 'woocommerce' ); ?></label>
<input pattern=".{17,}" required title="17 characters minimum" class="search-field" placeholder="<?php echo esc_attr_x( 'Search Products…', 'placeholder', 'woocommerce' ); ?>" value="<?php echo get_search_query(); ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label', 'woocommerce' ); ?>" />
<input type="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'woocommerce' ); ?>" />
<input type="hidden" name="post_type" value="product" />
But the same code (after copy/paste) doesn't work for the first search. This is the first/template default search code:
<div class="widget-search">
<form action="<?php echo esc_url( get_home_url() ); ?>/" class="searchform" id="searchform" method="get" role="search">
<input type="search" value="<?php echo get_search_query(); ?>" name="s" id="s" placeholder="<?php _e( 'Search...', 'pixar' ); ?>">
<button type="submit"> <i class="fa fa-search"></i> </button>
</form>
</div>
How to get the same result for the template default search? Simple copy/paste doesn't work.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire