• Hi! I’ve started to use sydney free recently. It’s a very convenient and customizable theme. Though I can’t find how to translate word “search” to “поиск” (poisk) in header search form button and input field. Which theme file is responsible for it? I haven’t found appropriate element in search.php и search-form.php. Can you help? Thanks for reading.

    Addition: also need to translate title in search results page – “Search Results for” and “Nothing found”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @edviser,

    Thank you for reaching out! We don’t currently have option to translate the search form.

    I’d recommend using the following code to translate the placeholder and submit button text:

    add_action( 'wp_footer', 'translate_search_form_with_js' );
    function translate_search_form_with_js() {
    ?>
    <script>
    document.addEventListener('DOMContentLoaded', function() {
    // Change placeholder
    var searchFields = document.querySelectorAll('.search-field');
    searchFields.forEach(function(field) {
    field.placeholder = 'поиск ...';
    });

    // Change submit button value
    var searchButtons = document.querySelectorAll('.search-submit');
    searchButtons.forEach(function(button) {
    button.value = 'поиск';
    });

    });
    </script>
    <?php
    }

    In case it helps, here’s our tutorial with the most common ways to add custom code like this.

    For the most beginner-friendly option in that tutorial, I’d recommend using the WPCode plugin.

    I hope this helps!

    Thread Starter Edward Bedarev

    (@edviser)

    Hi, @kmacharia! Thanks a lot. It works! Additional thanks for quick answer.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to translate search elements?’ is closed to new replies.