M
M
megajager2020-06-25 14:07:44
WordPress
megajager, 2020-06-25 14:07:44

How to replace text in select'e "All categories"?

Hello, tell me how to replace the text in the select button "All categories", for example, with "All categories", I found only how to fix the translation of Wordpress, from Russian to Russian, through crutches, if you suddenly do not like what is written in the button, but this method does not work with this element.

function rog_shop_strings( $translated_text, $text, $domain ) {
  
  if( 'woocommerce' === $domain ) {
  
    switch ( $translated_text ) {
      case 'В корзину' :
      $translated_text = 'Добавить в корзину';
      break;
    }
  
  }
  
  return $translated_text;
}
add_filter( 'gettext', 'rog_shop_strings', 20, 3 );

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-06-25
Matytsyn @ArsenyMatytsyn

On WP, this is all done without crutches, if the translations are entered correctly, namely, they lie in the mo and pot files .
If there are no translations, then you can find and redefine the sources. Redefine, not rewrite, that's important, don't shoot yourself in the foot.
Well, in the end, you can take a specific select and catch an option in JS with the value All categories and change it to anything. This is work at the level of operations with DOM nodes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question