Title: Custom fields
Last modified: October 9, 2017

---

# Custom fields

 *  Resolved [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * (@kavarnalife)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/)
 * Плагин работает великолепно, но у меня есть проблема с переводом дополнительных
   полей в моей теме. Например при добавлении материала у меня есть строка в админке,
   которую надо перевести.
 * выглядит это примерно так:
    <input id=”wiloke-location” type=”text” class=”text
   cmb_text_medium” name=”listing_settings[map][location]” value=”ул. „Цар Калоян"
   21-23, 9650 Център, Каварна, Болгария” placeholder=”Введите запрос” autocomplete
   =”off”>
 * в адресной строке так:
    /wp-admin/post.php?post=191&action=edit
 * Как мне правильно прописать эту строку для перевода в файле wpm-config.json ?
   
   Спасибо.

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9570692)
 * What name the meta field in WP database?
 *  Thread Starter [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * (@kavarnalife)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9570960)
 * мета в БД: listing_settings, в случае с конкретным полем listing_settings[map][
   location]
 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9571009)
 *     ```
       {
         "post_fields": {
           "listing_settings": {
             "map": {
               "location": {}
             }
           }
         }
       }
       ```
   
 * It`s config only for post field. If your meta field use multidimentional array
   You need set up config for each key, what You need to translate.
 *  Thread Starter [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * (@kavarnalife)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9571022)
 * Спасибо за подсказку. Реакция есть,но почему то в поле отображаются все переводы,
   вот так:
    [:en]ul. “Tsar Kaloyan” Center, Kavarna, Bulgaria[:bg]ул. „Цар Калоян”
   Център, Каварна, Болгария[:ru]ул.„Цар Калоян” Центр, Каварна, Болгария
 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9571252)
 * If your theme use function `get_post_meta_by_id` for get all metafield for post,
   filter result on PHP for that is imposible. Because this function don`t have 
   any filter before return result.
    But You can use JS function what is in WP Multilang
   for translate. As example:
 *     ```
       add_action( 'admin_enqueue_scripts', 'add_my_translator_script' );
       function add_translator_script() {
       	$screen    = get_current_screen();
       	$screen_id = $screen ? $screen->id : '';
   
       	if ($screen_id == 'custom_post_type' && $screen->parent_base == 'edit') {
       		wp_enqueue_script( 'wpm_translator' );
       		wpm_enqueue_js( "
       			(function ( $ ) {
       				$( '#wiloke-location' ).each( function () {
       					var text = wpm_translator.translate_string($(this).val());
       					$(this).val(text);
       				} );
       			})( window.jQuery );
       		" );
       	}
       }
       ```
   
 * Set up your needed screen_id.
    All available functions You can see in JS object`
   wpm_translator`.
 *  Thread Starter [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * (@kavarnalife)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9572156)
 * Спасибо, что помогаете. Да, насколько я понял, моя тема использует get_post_meta_by_id.
 * Скажите пожалуйста, этот скрипт из примера я должен добавить в файл ../wp-content/
   plugins/wp-multilang/assets/scripts/translator.js и в поле $screen->id : ”; вписывать
   id строки которую нужно перевести или значение name=?
 * Я должен добавить такой скрипт для каждой строки? Я правильно понял?
 * Так же хочу спросить на всякий случай, вы не оказываете платные услуги по настройке
   для конкретного сайта?
 * Спасибо.
 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9572847)
 * You need add this function to functions.php in your active theme.
    And here `
   $( '#wiloke-location' )` add all your needed selectors by coma separator.
 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9574265)
 * In new version available config for translation html tags by js.
    Udate please.
 *  Thread Starter [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * (@kavarnalife)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9574426)
 * Спасибо за помощь.
 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9574774)
 * You are welcome.
 *  [VaLeXaR](https://wordpress.org/support/users/valexar/)
 * (@valexar)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9626212)
 * Added possibility for adding html elements to config for translate by javascript.
 *  Thread Starter [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * (@kavarnalife)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9835028)
 * Hello.
    I can not add a line for translation: <input type = “text” id = “listing_tab_desc”
   name = “wiloke_themeoptions [listing_tab_desc]” value = “Description” class =“
   regular-text”>
 * This does not work:
    “admin_pages”: {      “wiloke_themeoptions”: {          “
   listing_tab_desc”: {}
 * In Qtranslate-X just added the line ID in the settings and everything worked.
 * Please tell me how to do it in your plugin?
 *  Thread Starter [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * (@kavarnalife)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9835155)
 * And one more small question. Do you plan to support the currently popular plugin
   Elementor builder?

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Custom fields’ is closed to new replies.

 * ![](https://ps.w.org/wp-multilang/assets/icon-256x256.png?rev=1760406)
 * [WP Multilang - Translation and Multilingual Plugin](https://wordpress.org/plugins/wp-multilang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-multilang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-multilang/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-multilang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-multilang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-multilang/reviews/)

 * 13 replies
 * 2 participants
 * Last reply from: [kavarnalife](https://wordpress.org/support/users/kavarnalife/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/custom-fields-262/#post-9835155)
 * Status: resolved