• Resolved sitsero

    (@sitsero)


    Hello, how can I change the displayed message after an empty search? It currently displays “No posts found!” and I want to change that to
    “Δε βρέθηκαν αποτελέσματα για την αναζήτησή σας. Εάν έχετε υπόψιν σας κάποιο συγκεκριμένο προϊόν, επικοινωνήστε μαζί μας και θα προσπαθήσουμε να το προσθέσουμε.”.
    I’m using the Storefront Theme and WooCommerce plugin.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @sitsero

    Use this snippet:

    add_filter( 'dgwt/wcas/labels', function ( $labels ) {
        $labels['no_results'] = 'Δε βρέθηκαν αποτελέσματα για την αναζήτησή σας. Εάν έχετε υπόψιν σας κάποιο συγκεκριμένο προϊόν, επικοινωνήστε μαζί μας και θα προσπαθήσουμε να το προσθέσουμε.';
        return $labels;
    } );

    You have two ways to add this code to your theme:
    Open the functions.php in your child theme and add the code at the end.
    or install the Code Snippets plugin and apply this code as a snippet.

    Regards,
    Kris

    • This reply was modified 4 years, 1 month ago by Kris.
    • This reply was modified 4 years, 1 month ago by Kris.
    Thread Starter sitsero

    (@sitsero)

    Thanks for the reply @c0nst , but the snippet isn’t working as intended.
    It’s been applied, but it didn’t change the “No posts found!” message.
    Here is a search result, so you can see it’s not working properly. Any advice would be appreciated, thanks in advance.

    Thread Starter sitsero

    (@sitsero)

    Don’t know if this helps, but for the default WooCommerce search I had the following code up and working

    add_action( 'woocommerce_no_products_found', function(){
        remove_action( 'woocommerce_no_products_found', 'wc_no_products_found', 10 );
    
        $message = __( 'Δε βρέθηκαν αποτελέσματα για την αναζήτησή σας. Εάν έχετε υπόψιν σας κάποιο συγκεκριμένο προϊόν, <a style="font-weight:bold" href ="https://sitsero.shop/επικοινωνία" id="epikoinwnia_tag">επικοινωνήστε</a> μαζί μας και θα προσπαθήσουμε να το προσθέσουμε.', 'woocommerce' );
    
        echo '<p class="woocommerce-info">' . $message .'</p>';
    	get_product_search_form();
    }, 9 );

    Τo be precise, I mean to change the “No posts found!” in the page, not under the dropdown at the search bar. In this selector:
    #eael-product-grid > div > p
    The element <p class="no-posts-found">No posts found!</p>

    • This reply was modified 4 years, 1 month ago by sitsero.
    • This reply was modified 4 years, 1 month ago by sitsero.

    Hi @sitsero

    To change that message: https://prnt.sc/TJk0_aq12JRA you can:

    1. Install and activate the Query Monitor plugin
    2. Go to the homepage and try to search for something that doesn’t have any results
    3. Check here which file is responsible for displaying that (like here: https://prnt.sc/WJyuJWvjGVUi). In StoreFront it may be content-none.php file
    4. Copy this file from your parent theme to the child keeping the structure of the folders
    5. Edit the file and change the text.

    Regards,
    Kris

    Thread Starter sitsero

    (@sitsero)

    Hello, thanks for the response.
    https://prnt.sc/Q8Km3kGYM6PP
    This is the template file as shown in the picture above, so I guess I can’t copy & configure it through the child theme. Is there a workaround for that?

    Kris

    (@c0nst)

    Hi @sitsero

    Thanks for the screenshot. It shows that Elementor has control over the search results page. I found a tutorial that shows how to take control over that here.

    I think this should solve your problem. Let me know if does.

    Regards,
    Kris

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

The topic ‘No posts found! message change’ is closed to new replies.