Home Forums Basel support forum Change "Show Sidebar" string

Change "Show Sidebar" string

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #158254

    algeorgiadis
    Participant

    Hello I would like to change the “Show Sidebar” text for the mobile off canvas sidebar to “Show Filters”, how can I do this?
    Thank you very much

    #158257

    Hello,

    You can translate all theme and plugin texts via PO file in WordPress. Here is a video tutorial that should help you translate your website texts with a Loco Translate plugin https://www.youtube.com/watch?v=D3NsDdMzsls&list=PLMw6W4rAaOgKKv0oexGHzpWBg1imvrval&index=3

    Best Regards

    #158259

    algeorgiadis
    Participant

    I understand How I can translate, but I am using WPML and I want it to be show filters for english and “show filters” in greek language as well
    I know that the string is in \basel\inc\woocommerce.php on line 2570 but can I override it with a function? because I don’t want to change the base theme files fo future updates.
    (ps. I have a child theme)

    #158339

    Hello,

    Please synchronize the translation as shown on the screen https://prnt.sc/q0gqlp

    Best Regards

    #158345

    algeorgiadis
    Participant

    I must rephrase.
    When I am in the english version of the website I see “show sidebar” and right now I am developing the greek frontend.
    I want this string to be “show filters” for the english version of the site (which is hardcoded right now in the \basel\inc\woocommerce.php on line 2570) and “Φίλτρα” for the greek version of the frontend.
    In order to translate the string I first need to override it from “show sidebar” to “show filters” and then translate it. Is there any way to do it with out changing in the core file (\basel\inc\woocommerce.php on line 2570)? by copying this file for example in my child theme or should I change the string directly and have it in mind to change it every time I update the theme?

    #158346

    Hello,

    WPML is a multilingual plugin and it does not provide the option to change the wording. It takes the existing phrase and provides the option to translate it. That is why I suggested the Loco plugin. You change the wording and then make the translation. Please refer to the documentation of WPML or contact their support and check the Loco documentation.

    Best Regards

    #158349

    algeorgiadis
    Participant

    I know that wpml can not change the wording that is why I asked how to override the standard string “show sidebar” with code in functions.php or by copying and altering the woocommerce.php file in my child theme folder.
    Nevermind I created a function to alter strings.
    For anyone who is interested in this here’s the function:

    // Change the show sidebar tag
    function my_altered_strings( $altered_text, $text, $domain ) {
      switch ( $altered_text ) {
        case 'Show sidebar' :
          $altered_text = __( 'Show filters', 'woocommerce' );
        break;
       }
        return $altered_text;
    }
    add_filter( 'gettext', 'my_altered_strings', 20, 3 );

    Thank you.

    #158351

    Ok. If you have any questions please feel free to contact us.

    Best Regards

    #158352

    algeorgiadis
    Participant

    Thank you very much for your time Elise.
    Have a nice day.

    #158359

    You are welcome!

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Change "Show Sidebar" string’ is closed to new replies.