Created
October 23, 2013 14:14
-
-
Save mjepson/7119585 to your computer and use it in GitHub Desktop.
Modify Canvas search form to only search WooCommerce products if you are on a WooCommerce page
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
<?php global $woo_options; ?> | |
<div class="search_main"> | |
<form method="get" class="searchform" action="<?php echo home_url( '/' ); ?>" > | |
<input type="text" class="field s" name="s" value="<?php _e( 'Search...', 'woothemes' ); ?>" onfocus="if (this.value == '<?php _e( 'Search...', 'woothemes' ); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search...', 'woothemes' ); ?>';}" /> | |
<?php if ( isset( $woo_options['woo_header_search_scope'] ) && $woo_options['woo_header_search_scope'] == 'products' && is_woocommerce_activated() && is_woocommerce() ) { echo '<input type="hidden" name="post_type" value="product" />'; } ?> | |
<button type="submit" class="icon-search submit" name="submit" value=""></button> | |
</form> | |
<div class="fix"></div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment