Title: Doesn&#8217;t recognize string added via custom setting
Last modified: May 20, 2023

---

# Doesn’t recognize string added via custom setting

 *  Resolved [Nic727](https://wordpress.org/support/users/nic727/)
 * (@nic727)
 * [3 years ago](https://wordpress.org/support/topic/doesnt-recognize-string-added-via-custom-setting/)
 * Hi,
 * I’m trying to translate my main website title, but I’m unable to do it. I’ve 
   create custom settings for my page.
 * ![](https://i0.wp.com/i.postimg.cc/43jzgd0n/image.png?ssl=1)
 * Code used in functions.php
 *     ```wp-block-code
       function aurora_customize_register( $wp_customize ) {
           // Do stuff with $wp_customize, the WP_Customize_Manager object.
   
           /* Pinegrow generated Customizer Controls Begin */
           $pgwp_sanitize = function_exists('pgwp_sanitize_placeholder') ? 'pgwp_sanitize_placeholder' : null;
   
           $wp_customize->add_section( 'aurora_default_cs', array('title' => 'Personnalisation de la page d\'accueil'));
   
           $wp_customize->add_setting( 'home_img', array(
               'type' => 'theme_mod',
               'sanitize_callback' => $pgwp_sanitize
           ));
   
           $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'home_img', array(
               'label' => __( 'Image de l\'accueil', 'aurora' ),
               'type' => 'media',
               'mime_type' => 'image',
               'section' => 'aurora_default_cs'
           ) ) );
   
           $wp_customize->add_setting( 'home_vid', array(
               'type' => 'theme_mod',
               'sanitize_callback' => $pgwp_sanitize
           ));
           $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, 'home_vid', array(
               'label' => __( 'Home video', 'aurora' ),
               'type' => 'media',
               'mime_type' => 'video',
               'section' => 'aurora_default_cs'
           ) ) );
           function allow_video_upload( $existing_mimes ) {
               $existing_mimes['mp4'] = 'video/mp4';
               $existing_mimes['mov'] = 'video/quicktime';
               // Ajoutez d'autres extensions de fichiers vidéo si nécessaire
               return $existing_mimes;
            }
            add_filter( 'mime_types', 'allow_video_upload' );
   
            $wp_customize->add_setting( 'main_title', array(
               'type' => 'theme_mod',
               'default' => '',
               'sanitize_callback' => $pgwp_sanitize
           ));
   
           $wp_customize->add_control( 'main_title', array(
               'label' => __( 'Titre principal', 'aurora' ),
               'type' => 'text',
               'section' => 'aurora_default_cs'
           ));
   
           $wp_customize->add_setting( 'sub_title', array(
               'type' => 'theme_mod',
               'default' => '',
               'sanitize_callback' => $pgwp_sanitize
           ));
   
           $wp_customize->add_control( 'sub_title', array(
               'label' => __( 'Sous-titre', 'aurora' ),
               'type' => 'text',
               'section' => 'aurora_default_cs'
           ));
   
   
       }
       function register_theme_strings() {
           pll_register_string('aurora', get_theme_mod('main_title'), 'aurora', true);
           pll_register_string('aurora', get_theme_mod('sub_title'), 'aurora', true);
       }
       add_action('init', 'register_theme_strings');
       ```
   
 * And in my front-page.php
 *     ```wp-block-code
       $main_title = get_theme_mod( 'main_title' );
       $sub_title = get_theme_mod( 'sub_title' );
   
        <div class="home-title"> 
                   <h1><?php pll_e($main_title); ?></h1> 
                   <h2><?php pll_e($sub_title); ?></h2> 
               </div>             
       ```
   
 * Any idea how it can recognize that?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Marcin Kazmierski](https://wordpress.org/support/users/marcinkazmierski/)
 * (@marcinkazmierski)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/doesnt-recognize-string-added-via-custom-setting/#post-16823726)
 * [@nic727](https://wordpress.org/support/users/nic727/) I apologise for the delay.
   This is already a problem with Polylang plugin. Please use:
 * **pll_register_string**
 * Allows plugins to add their own strings in the “strings translation” panel. The
   function must be called on admin side (the functions.php file is OK for themes).
   It is possible to register empty strings (for example when they come from options)
   but they won’t appear in the list table.
 * From documentation: [https://polylang.pro/doc/function-reference/](https://polylang.pro/doc/function-reference/)
 * Same example: [https://gist.github.com/dworkz/688c5ff12f193b1d0534](https://gist.github.com/dworkz/688c5ff12f193b1d0534)

Viewing 1 replies (of 1 total)

The topic ‘Doesn’t recognize string added via custom setting’ is closed to new replies.

 * ![](https://ps.w.org/theme-translation-for-polylang/assets/icon-256x256.png?rev
   =1431912)
 * [Theme and plugin translation for Polylang (TTfP)](https://wordpress.org/plugins/theme-translation-for-polylang/)
 * [Support Threads](https://wordpress.org/support/plugin/theme-translation-for-polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/theme-translation-for-polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/theme-translation-for-polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/theme-translation-for-polylang/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Marcin Kazmierski](https://wordpress.org/support/users/marcinkazmierski/)
 * Last activity: [2 years, 11 months ago](https://wordpress.org/support/topic/doesnt-recognize-string-added-via-custom-setting/#post-16823726)
 * Status: resolved