• Resolved timholz

    (@timholz)


    Hi

    I tried to change the breadcrumb text that is displayed when a search query is launched.
    Right now it reads:?Search results for “xy”.
    It altered the text in the original file ?class-wc-breadcrumb.php? on line 321, but it has no effect.
    I also tried overriding the original with the following path:
    child>woocommerce>includes>class-wc-breadcrumb.php
    No luck either.

    Does anyone know how to change the breadcrumb words displayed when a search query is launched?

    Thanks for your interest.

    regards
    theo

    https://www.ads-software.com/plugins/woocommerce/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter timholz

    (@timholz)

    Hi

    I found the file.
    It’s in the admin-functions.php on line 2811.

    On line 2534 this file it says:
    * Allow filtering of only the $args using get_the_breadcrumb_args.

    How can i write this filter?
    I have very little knowledge about this subject.

    Your help is appreciated.

    Thank you.

    regards
    theo

    Thread Starter timholz

    (@timholz)

    Hi

    I wrote this filter and added to my_child>functions.php:

    /*Translation filter for ?Search results for? and ?404 Not Found? in ?admin-functions.php? (mystile, wootheme) */
    function replace_search_notfound($trail) {
      $trail = str_replace ( "Search results for" , "Your translation" , $trail );
      $trail = str_replace ( "404 Not Found" , "404 Your translation" , $trail );
      return $trail;
    }
    add_filter( 'woo_breadcrumbs' , 'replace_search_notfound',10);

    Seems to work.

    regards
    theo

    Wow, this is extactly what am i looking for. Awesome Theo.

    But i don’t know where is the place to put the functions.php file? Could you help me take a look?

    I tried to copy to wp-content/mytheme/functions.php and wp-content/my-childtheme/functions.php but it both didn’t works. I’m using the theme integrated with the plugin already (Here is the theme in case you want to know link)

    Thanks again.

    Thread Starter timholz

    (@timholz)

    Hi

    It appears that you have two child-theme folders.
    Which one is the active?
    My directory is:
    wp-content/themes/parent-theme and child-theme
    So both the parent and the child are on the same level and
    in both there should be a functions.php. Well at least i assume that you parent-theme has one.
    So, you should place your custom functions.php in the child-theme folder.

    This should work, for the functions.php in your child-theme folder is considered first, then the routine continues with the parent theme functions.php.

    I hope that this helps.

    regards
    theo

    My site now using the child theme.

    Yes, the parent theme has one functions.php then i tried to place it to child theme already.

    https://www.site.com/wp-content/themes/flatsome (this is the parent theme with the original functions.php inside).
    https://www.site.com/wp-content/themes/flatsome-child (this is the child theme activated, i tried to place functions.php here but it not works).

    Any problem here? As i see, none of words placed at breadcrumb can be translated, i don’t know this is the bug or not.

    Thread Starter timholz

    (@timholz)

    Both links look identical to begin with.
    Are you copying the whole parent functions.php into your child-theme folder?
    Apparently there is some confusion.
    So let’s make a test.
    Make a backup copy of the child-theme’s functions.php and name it for instance ?functions_backup.php?
    Create a new functions.php and put it in your child-themes folder.
    In this new functions.php you write:

    <?php
    echo 'test';
    ?>

    Reload the page.
    You should now see the word test printed on the screen.
    It that works, then you know, that functions.php in your child-theme folder is active.
    And in case that is true, you can start filling functions.php with your own hooks, filters and functions.

    If that is not the case, then something is definitely wrong and you should probably contact the support of your parent theme.

    Good luck
    regards

    Thread Starter timholz

    (@timholz)

    Sorry, i made a mistake.
    Forget about the previous message.
    My filter only works with woothemes and woocommerce.
    You will have to search your parent theme and find the place where the breadcrumbs are generated and then use that naming convention to filter words.

    In case you have support for your theme, i could try to contact them for help.
    regards
    theo

    Thread Starter timholz

    (@timholz)

    of course i meant, that you could try to contact the theme support…

    Hi Theo, you’re very kind.

    I’m very appreciated your help ?? I’m contacting with theme support, hope they can help me resolve this issue.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Breadcrumb words in Search-Results’ is closed to new replies.