Tagged: x
-
AuthorPosts
-
March 11, 2017 at 11:32 pm #1403544
undertheboParticipantHi,
Whatever languages we are using with the search on X Theme (+WPML) the results are only in English….
How to get them in the appropriate language ?
For example if I am on the French version : https://underthebo.com/?lang=fr
And looking for Bronze, the theme brings me to this page https://underthebo.com/?s=bronze and show only English results…
It is like if the “lang=fr” is missing…., should be https://underthebo.com/?s=bronze&lang=frThanks for you help
March 12, 2017 at 5:06 am #1403676
ChristianModeratorHey there,
To make the search form multilingual, you need to modify searchform.php. Please copy
searchform.phplocated inwp-content\themes\xto the same folder structure in your child themewp-content\themes\x-child. Open the copied file then insert this code<input type="hidden" name="lang" value="<?php echo(ICL_LANGUAGE_CODE); ?>"/>below the line
<input type="text" id="s" class="search-query" name="s" placeholder="<?php esc_attr_e( 'Search', '__x__' ); ?>" />Thanks.
March 12, 2017 at 5:27 am #1403685
undertheboParticipantHi Christian,
Thank you, but it’s still showing only English results…
Please take look here : https://underthebo.com/?lang=fr and search for PETITE (=small in French) for example
Thanks,
March 12, 2017 at 5:47 am #1403696
ChristianModeratorPlease try adding the code below in your functions.php
function x_navbar_searchform_overlay() { if ( x_get_option( 'x_header_search_enable' ) == '1' ) : ?> <div class="x-searchform-overlay"> <div class="x-searchform-overlay-inner"> <div class="x-container max width"> <form method="get" id="searchform" class="form-search center-text" action="<?php echo esc_url( home_url( '/' ) ); ?>"> <label for="s" class="cfc-h-tx tt-upper"><?php _e( 'Type and Press “enter” to Search', '__x__' ); ?></label> <input type="text" id="s" class="search-query cfc-h-tx center-text tt-upper" name="s"> <input type="hidden" name="lang" value="<?php echo(ICL_LANGUAGE_CODE); ?>"/> </form> </div> </div> </div> <?php endif; } add_action( 'x_before_site_end', 'x_navbar_searchform_overlay' );Thanks.
March 12, 2017 at 6:01 am #1403707
undertheboParticipantThanks again Christian but still not working….
Is there a way to pass this information in the URL ?
I we can to get something like https://underthebo.com/?s=petite&lang=fr it will workThanks
March 12, 2017 at 7:05 am #1403761
ChristianModeratorThe code should do that for you. But since it doesn’t work, you’ll need to contact WPML support for them to investigate your settings. Please tell them what you’ve done to the templates already.
Thanks.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1403544 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
