This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic is split from https://wpml.org/forums/topic/search-bar-is-not-only-disappearing-but-also-showing-odd-icons/
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: Asia/Singapore (GMT+08:00)
Author | Posts |
---|---|
January 15, 2025 at 8:36 am #16596090 | |
sandraF-13 |
Hi Kor, Thanks A many, It got resolved finally... However, I have translated all the strings related to Search.. CAn you please take a look into this. |
January 15, 2025 at 11:57 am #16596956 | |
sandraF-13 |
I hope looked into it yet. |
January 15, 2025 at 3:33 pm #16597997 | |
Kor Supporter
Languages: English (English ) Timezone: Asia/Singapore (GMT+08:00) |
Thanks for your reply. I've checked and since you're using some custom code to create the search form, you'll need to specify a text domain to uniquely identify the translations of your hard-coded strings. You can read more about it here https://wpml.org/documentation/support/translating-the-theme-you-created/ Example. <button class="btn btn-primary" type="submit"> <span class="fa fa-search"></span> <?php _e('Submit', 'custom-search'); ?> </button> |
January 15, 2025 at 5:29 pm #16598615 | |
sandraF-13 |
Do I need to follow all those confusing 5 steps in order to translate this SEARCH. |
January 15, 2025 at 5:43 pm #16598693 | |
Kor Supporter
Languages: English (English ) Timezone: Asia/Singapore (GMT+08:00) |
Thanks for your reply. I've generated this using ChatGPT and I hope it helps. DISCLAIMER: Please know that any snippet or code suggested here is for educational purposes only. they are not meant to be the final solution but instead meant to point you in the right direction and are out of the scope of our support so we can't nor will modify, improve, debug or maintain it. Take note of the strings with the text domain "custom-search". Keep in mind that what I'm doing here is voluntary and out of our support scope and I hope you understand. You can try to replace the custom search code with this one. Then, go to string translation and search for the strings with the text domain "custom-search". Then, translate the strings. If it doesn't work or you need further help with this custom programming work, which is beyond the scope of our support, I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/ // Display the search box with category dropdown function searchbox_cate_dropdown($atts) { // Set default attributes $atts = shortcode_atts(array( 'mobile' => false, ), $atts); ob_start(); // Get selected category ID from query parameters $selected_id = isset($_GET['cat']) ? intval($_GET['cat']) : 0; // Create the dropdown for categories $select = wp_dropdown_categories(array( 'show_option_all' => __('Entire Site', 'custom-search'), 'show_option_none' => '', 'orderby' => 'ID', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 0, 'child_of' => 0, 'exclude' => 1, 'echo' => 0, 'selected' => $selected_id, 'hierarchical' => 1, 'name' => 'cat', 'class' => 'form-no-clear', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'category', 'hide_if_empty' => true )); // Generate the search box ID based on mobile attribute $searchBoxId = "headerSearchBox" . ($atts['mobile'] ? "Mobile" : ""); // Output the search form ?> <div id="<?php echo esc_attr($searchBoxId); ?>"> <div class="search-box header"> <form role="search" method="get" class="search-form" action="<?php echo esc_url(home_url('/')); ?>"> <?php echo $select; ?> <input type="text" value="<?php echo esc_attr(isset($_GET['s']) ? $_GET['s'] : ''); ?>" title="<?php _e('Enter Your Search Term', 'custom-search'); ?>" class="form-control" name="s" id="s" placeholder="<?php _e('Search', 'custom-search'); ?>"> <button class="btn btn-primary" type="submit"> <span class="fa fa-search"></span> <?php _e('Submit', 'custom-search'); ?> </button> </form> </div> </div> <?php return ob_get_clean(); } add_shortcode('searchbox', 'searchbox_cate_dropdown'); |
January 17, 2025 at 9:10 am #16604902 | |
sandraF-13 |
Got It, will get back to you soon, |
January 17, 2025 at 1:40 pm #16606347 | |
Kor Supporter
Languages: English (English ) Timezone: Asia/Singapore (GMT+08:00) |
Yes, that's correct. We call that GetText Calls https://wpml.org/documentation/support/translating-the-theme-you-created/#wrap-all-texts-in-gettext-calls . Let me know how it goes. |
January 20, 2025 at 5:43 pm #16615068 | |
sandraF-13 |
Hi Kor, Once again here, but didn't saw any change, I mean I tried finding the string name in the string translation but it did not appear, what can be the possible reason. Can you please take a look here. thanks |
January 20, 2025 at 5:46 pm #16615091 | |
Kor Supporter
Languages: English (English ) Timezone: Asia/Singapore (GMT+08:00) |
Thanks for your reply. Did you use the code that I shared here? https://wpml.org/forums/topic/submit-button-and-entire-site-option-strings-not-getting-translated/#post-16598693 |
January 21, 2025 at 5:42 am #16616381 | |
sandraF-13 |
Yep the same, you shared, you can check through SFTP |
January 21, 2025 at 5:42 am #16616382 | |
sandraF-13 |
Its on staging and not on production |
January 21, 2025 at 6:01 am #16616390 | |
Kor Supporter
Languages: English (English ) Timezone: Asia/Singapore (GMT+08:00) |
Thanks for your reply. Ok, I'm looking at the wrong site. Could you update the credentials here again? Your staging site credentials were removed from your old ticket for security purposes. Keep in mind that what I'm doing here is voluntary and out of our support scope and I hope you understand. |
January 21, 2025 at 11:50 am #16618167 | |
Kor Supporter
Languages: English (English ) Timezone: Asia/Singapore (GMT+08:00) |
Thanks for your reply. This is what I've done. 1. I scanned the child theme since the code is in the functions.php file. 2. Then, you'll see the strings with the text domain "custom search" in string translations . Check out this screen recording hidden link |
January 23, 2025 at 6:15 am #16625663 | |
sandraF-13 |
Hi Kor, I put them on translation but they are still under processing. |
January 23, 2025 at 9:02 am #16626269 | |
Kor Supporter
Languages: English (English ) Timezone: Asia/Singapore (GMT+08:00) |
Thanks for your reply. If you send them for translation, it will appear here hidden link in the translation queue. |