• Resolved martmarie1

    (@martmarie1)


    Good day,

    The “for” text in the Search Results on the results page can’t be altered in the backend settings for the “Results” page options. Here I can alter everything else that I want except for this. The site is in German, and now the “for” is the only text in English on the results page where it states “Zeige Ergebnisse 1 bis 10 von 12 for ‘d’ ” (Show results 1 to 10 of 12 for ‘d’). The “for” text is not wrapped in a span element. Thus, I can’t even hide it with CSS and add an after-pseudo class to add my preferred text “for”. I tested by switching the site’s language from English to German and it didn’t alter the text. Please assist

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author SearchIQ

    (@searchiq)

    Unfortunately, we can’t change the text that you have mentioned. We can only change the text that is provided in the settings.

    Thread Starter martmarie1

    (@martmarie1)

    Can you please see? I tried to just write “für” after, but then I have “für/for” being displayed. Because that whole sentence I can change except for the “for” text. The text is in the same div element that I can alter in the backend settings except for the “for” text. Can you wrap that text in a span element? Then atleast I can hide it and add my own after-psuedo element.

    Plugin Author SearchIQ

    (@searchiq)

    We will check with our team and update you.

    Plugin Author SearchIQ

    (@searchiq)

    You can remove the text node using JavaScript by rendering the complete event. Please find the event name: siq-search-page-results-render-complete

    You can use it like, $(document).on(‘siq-search-page-results-render-complete’, …)

    Plugin Author SearchIQ

    (@searchiq)

    Hi,
    Please confirm if this solution worked for your site.

    Thread Starter martmarie1

    (@martmarie1)

    Hello,

    Thank you for your assistance in this case. Yes, the solution work and this is how I implemented it, added a class too, to make sure that my styling remain the same.

    <!-- ALTER THE TEXT OF "FOR" IN SEARCH RESULTS PAGE -->
    <script>
    jQuery(document).ready(function($) {
    	
    	$(document).on('siq-search-page-results-render-complete', function() {
        // Select the element containing the text you want to modify
        var element = $('.siq-show-result');
    
        // Check if the element exists
        if (element.length > 0) {
            // Get the current text content
            var currentText = element.text();
    
            // Replace "for" with "für"
            var newText = currentText.replace(/for/g, 'für');
    
            // Wrap the modified text in a <span> element
            var spanElement = $('<span>').addClass('ne-searchiq-filter-text-new').text(newText);
    
            // Replace the content of the original element with the <span>
            element.html(spanElement);
        }
    	});
    });
    </script>
    Plugin Author SearchIQ

    (@searchiq)

    Great to know it worked.
    Please feel free to contact us if you face any issues.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘“for” in Search Results – alter text for translation’ is closed to new replies.