WP Multilang do not using html tags or css selectors for set configuration. About it described in description to the plugin.
WP Multilang working with database.
Ok, what can I do to translate this sentence without losing HTML tags?
@obadaqawwas
You need to add option name as it named in the database in config file. And to the option will be added language tags on saving.
Ok, can you provide an example for the config file working with any of Redux options?
My config file is like this
{
“options”: {
“wowmall_options”: {
“header_text”: {},
“header_cart_text”: {},
}
}
}
and the textarea which it’s in header_text contains the following (I tried to change HTML tags so I can paste it here)
- <span class="myfont-location-1"></span>Address: Mes%u0327rutiyet Mah., Kodoman Sok., No: 47/D, Osmanbey – %u015Eis%u0327li / %u0130stanbul
- <span class="myfont-phone"></span>Phone: 90 552 22 22 952
I want to translate the inner sentences with [:en][:]
Thanks for your help
I do not using Redux framework.
Find the value in options table in a database. Then look at the name of the option in the ‘option_name’ column. It will be the option name for using in config file.
My options are stored in the database under wowmall_options and the option that I want to translate are header_text and header_cart_text, so what’s the wrong with my config file?
@obadaqawwas
Strings that you need saved in the database with html tags or not? For saving strings, You need to use language switcher in admin.
Add your setting page to the “admin_screen” section in the config. And save text for each language.
@obadaqawwas
Strings that you need saved in the database with html tags or not? For saving strings, You need to use language switcher in admin.
Add your setting page ID to the “admin_screen” section in the config. And save text for each language.
Thank you for replying, my strings are saved with HTML tags in database.
if you could provide an example for the config file it will be appreciated
1. Add language switcher to theme page settings if it not exist.
Use get_current_screen on this page for getting object WP_Screen and get from this id property.
add_action('admin_head', function(){
$screen = get_current_screen();
var_dump($screen->id);
});
Add the received value to “admin_pages” section in your config file.
"admin_pages": [
"admin_screen_id"
]
2. If your option “wowmall_options” is array and needed option is on the first level in the array add config for your option to “options” section in the config file.
“options”: {
“wowmall_options”: {
“header_text”: {},
“header_cart_text”: {},
}
}
After these actions, the language selector should appear on the theme settings page. You will need to enter the value of this field for each language.
Thank you so much, I will try it and tell you the results
I added this:
add_action(‘admin_head’, function(){
$screen = get_current_screen();
var_dump($screen->id);
});
in functions.php to get ID, and it returned this value “toplevel_page_wowmall_options_options”.
Then I went to edit the config file and I made like this:
{
“admin_pages”: [
“toplevel_page_wowmall_options_options”
],
“options”: {
“wowmall_options”: {
“header_text”: {},
“header_cart_text”: {}
}
}
}
Then thanks to you, everything is working fine, but I have two language selectors above each other like this:
http://balanciafashion.com/Screen%20Shot%202018-02-08%20at%204.29.16%20PM.png
Your help was really appreciated, thank you so much
Regards
Try to delete ‘toplevel_page_wowmall_options_options’ from
“admin_pages”: [
“toplevel_page_wowmall_options_options”
],