Created
February 5, 2014 14:35
-
-
Save goliver79/8824907 to your computer and use it in GitHub Desktop.
[WOOCOMMERCE] Modify navigation search form
This file contains hidden or 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 | |
/** | |
* modify search form | |
* - "search for products" string translate | |
* - language for qTranslate | |
*/ | |
add_action( 'after_setup_theme', 'lgpd_change_search_nav' ); | |
function lgpd_change_search_nav(){ | |
remove_action('woo_nav_before', 'wootique_header_search'); | |
add_action('woo_nav_before', 'lgpd_wootique_header_search'); | |
} | |
function lgpd_wootique_header_search() { | |
global $woo_options; | |
?> | |
<div id="search-top"> | |
<form role="search" method="get" id="searchform" class="searchform" action="<?php echo home_url() . "?lang=" . qtrans_getLanguage(); ?>"> | |
<label class="screen-reader-text" for="s"><?php _e('Search for:', 'woothemes'); ?></label> | |
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" class="field s" placeholder="<?php _e('Search for products', 'my_text_domain'); ?>" /> | |
<input type="image" class="submit btn" name="submit" value="<?php _e('Search', 'woothemes'); ?>" src="<?php echo get_template_directory_uri(); ?>/images/ico-search.png"> | |
<!-- @goliver hidden field for qTranslate --> | |
<input type="hidden" name="lang" value="<?php echo qtrans_getLanguage(); ?>"> | |
<?php if ($woo_options['woo_header_search_scope'] == 'products' ) { echo '<input type="hidden" name="post_type" value="product" />'; } else { echo '<input type="hidden" name="post_type" value="post" />'; } ?> | |
</form> | |
<div class="fix"></div> | |
</div><!-- /.search-top --> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment