Hello @iuliaradu,
Try this script by adding it to the functions.php file of your theme:
function gmw_custom_modify_taxonomy_default_value( $args, $tax, $gmw ) {
// Replace 1 with the form ID that you'd like to modify.
if ( 1 !== absint( $gmw['ID'] ) ) {
return $args;
}
// Change 'category' to the taxonomy you'd like to modify.
if ( 'category' !== $args['taxonomy'] ) {
return $args;
}
// Change 'some text' with the actual text that you'd like to use as the default option.
$args['show_option_all'] = 'Toate categoriile de produse';
return $args;
}
add_filter( 'gmw_search_form_dropdown_taxonomy_args', 'gmw_custom_modify_taxonomy_default_value', 50, 3 );
Hi,
I have tried it several times and it is not working. Not sure why. I have also tried to do it via Loco Translate but it’s not working at all, I cannot find the string. 🙁
Many thanks.
Hi,
Could you still help me with this please?
Thanks.
Kind regards,
iulia
HI @ninjew, could you you still please help me with this? The coding inserted did not work.
@iuliaradu,
I just tested the script on my site and it works so I am not sure why it is not working for you.
What is the ID of the form that you are trying to modify?
Did you place the script in the functions.php file of your theme?
Hello,
I tried again, in the functions php and it’s not working.
ID is 1.
Thank you.
@ninjew is there anything else to try? I even tried loco translate but I find to impossible to find the string for ”Al Categories”.
Thank you.
@iuliaradu,
I now realized that you are using a custom taxonomy and not the native category taxonomy.
In the script you added to the functions.php file, please replace:
if ( 'category' !== $args['taxonomy'] ) {
with
if ( 'product_cat' !== $args['taxonomy'] ) {
Let me know if this works.
Yey! I worked! Thank you millions!!!
You are very welcome, @iuliaradu.