Filter widget search string placeholder translation

This topic has 2 replies, 2 voices, and was last updated 1 weeks, 5 days ago ago by Andrew Mitchell

  • Avatar: webshockstudio
    wssrob
    Participant
    February 13, 2025 at 17:18

    Dear support,
    how do I translate the placeholder of the search widget, in the filters?

    <input type="search" id="woocommerce-product-search-field-0" class="search-field" placeholder="Search products…" value="" name="s">

    Tried searching for placeholder in every file in theme and plugins folder, no results…tried intercepting the field in the DOM and with CSS, no joy……but that placeholder stays there, no matter what….

    I solved this problem using this code in functions.php of my child theme.

    
    add_filter('gettext', 'translate_strings');
    add_filter('ngettext', 'translate_strings');
    function translate_strings($translated) {
    $translated = str_ireplace('Search products&hellip;', 'MYTRANSLATION', $translated);	
    	return $translated;
    }
    

    The key here was &hellip; , I rarely see this and my replacement code did not work for that very reason!

    Content is visible for topic creator and
    support staff only.
    1 Answer
    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    February 13, 2025 at 17:31

    Dear wssrob,

    We hope you’re reveling in the experience our theme brings! Your enthusiasm is what fuels our passion. Would you be so kind as to channel that energy into a 5-star rating on ThemeForest? Your feedback is the spark that lights our way!

    Click here to spread the love: https://themeforest.net/downloads

    Thank you for being an integral part of our journey!

    Best Regards,
    The 8Theme Team

  • Viewing 2 results - 1 through 2 (of 2 total)

The issue related to '‘filter widget search string placeholder translation’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.