Title: Polylang strings in front-page.php
Last modified: August 22, 2016

---

# Polylang strings in front-page.php

 *  Resolved [coralepuccini](https://wordpress.org/support/users/coralepuccini/)
 * (@coralepuccini)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/)
 * Hi, I’ve installed the plugin polylang and I was able to translate 90% of homepage
   strings. I don’t find the way to translate the main title of sections. I noticed
   that subtitle and content of section just are displayed on admin menù polylang
   and they are able to be translated, but main title is not recognized.The code
   of main title section in fron-page.php is this:
 * <?php $zerif_contactus_title = get_theme_mod(‘zerif_contactus_title’,’Get in 
   touch’);
    if ( !empty($zerif_contactus_title) ): echo ‘<h2 class=”white-text”
   >’.$zerif_contactus_title.'</h2>’; endif; $zerif_contactus_subtitle = get_theme_mod(‘
   zerif_contactus_subtitle’); if(isset($zerif_contactus_subtitle) && $zerif_contactus_subtitle!
   = “”): echo ‘<h6 class=”white-text”>’.$zerif_contactus_subtitle.'</h6>’; endif;?
   > </div>
 * I create a translation string with pll_register_string for zerif_contactus_title
   in functions.php of theme, but when I add pll_e to echo codex the $zerif_contactus_title
   seems doesn’t work.
 * This is the function:
 * pll_register_string(‘contacts’, ‘$zerif_contactus_title’, ‘zerif-lite’);
 * Any ideas?

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/page/2/?output_format=md)

 *  [Hardeep Asrani](https://wordpress.org/support/users/hardeepasrani/)
 * (@hardeepasrani)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800021)
 * Hi,
 * You can change titles from Appearance > Customizer section, you don’t need to
   use a plugin for that part. 🙂
 * Regards,
    Hardeep
 *  Thread Starter [coralepuccini](https://wordpress.org/support/users/coralepuccini/)
 * (@coralepuccini)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800032)
 * Hi, thanks for your fast answer, but I use polylang and on customizer I can only
   add text in one language. For example Contact section is customizable and default
   language is Italian. How I can add translation in English language?
 *  Thread Starter [coralepuccini](https://wordpress.org/support/users/coralepuccini/)
 * (@coralepuccini)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800106)
 * Maybe I wrote the question in a bad way :).
    On customizer section I can change
   the text but I need to translate it in English language. I use plugin polylang
   that use string translation but I don’t find the way to translate, as I posted
   above, the $string “$zerif_contactus_title”. The others fields I was able to 
   do but this one nothing
 * I appreciate help.
 * Thanks very much
 *  [MariusG](https://wordpress.org/support/users/marius_codeinwp/)
 * (@marius_codeinwp)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800125)
 * Hello,
 * Are you having troubles with translating the Contact Us section only? Or are 
   there any other sections as well?
    I have not worked with Polylang before, but
   I’ll look into it and be back with an answer 🙂
 * Kind regards,
    Marius
 *  [jeannettemeier](https://wordpress.org/support/users/jeannettemeier/)
 * (@jeannettemeier)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800142)
 * Hi! We have the same problem: translations are defined but Main Titles remain
   in the original language (the first language in which the site has been created).
   The rest appears in the correct language.
 * In addition, as the menu custom settings should link to the site sections via
   URLs set as [http://sitename.com/#focus](http://sitename.com/#focus) or #aboutus,#
   team, etc, how do we link the menus according to the languages? In our case we
   have 2 menus (English, Spanish): both menus link to the same section of one specific
   language (in our case: English) since the URL is the same. But are we able to
   change it to e.g. #focus1, #aboutus1 and do any specific change in any of the
   php files so that it links to the specific section in the correct language?
 * Thanks!
 *  Thread Starter [coralepuccini](https://wordpress.org/support/users/coralepuccini/)
 * (@coralepuccini)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800143)
 * Hi, I resolved the problem: follow exactly the steps below:
 * Open function.php in theme root and add at the end of lines these strings:
 * // About us translation
    pll_register_string(‘About Us’,’zerif_aboutus_title’,’
   zerif-lite’); // Our focus translation pll_register_string(‘Our focus’,’zerif_ourfocus_title’,’
   zerif-lite’); // Contact us translation pll_register_string(‘zerif_contactus_title’,’
   Get in touch’,’zerif-lite’); // Latest news translation pll_register_string(‘
   Latest news’,’zerif_latestnews_title’,’zerif-lite’); // Testimonials translation
   pll_register_string(‘Testimonials’,’zerif_testimonials_title’,’zerif-lite’); //
   Our team translation pll_register_string(‘Our Team’,’zerif_ourteam_title’,’zerif-
   lite’);
 * Go to Polylang main menù and make the necessary translation you need.
 * After open each php file section in the sections folder and replace the follow
   line with this:
 * **Old line**
    if( !empty($zerif_aboutus_title) ): echo ‘<h2 class=”white-text”
   >’.__($zerif_aboutus_title,’zerif-lite’).'</h2>’; endif; ?>
 * **New line**
    if( !empty($zerif_aboutus_title) ): echo ‘<h2 class=”white-text”
   >’.pll__(‘zerif_aboutus_title’,’zerif-lite’).'</h2>’; endif; ?>
 * Follow the above steps to each php section page replacing the $variable after
   class text into correct name without $.
 * **On contact us open front page.php and replace this line:**
 * $zerif_contactus_title = get_theme_mod(‘zerif_contactus_title’,’Get in touch’);
   
   if ( !empty($zerif_contactus_title) ): echo ‘<h2 class=”white-text”>’.$zerif_contactus_title.'
   </h2>’; endif;
 * **with this:**
 * $zerif_contactus_title = get_theme_mod(‘zerif_contactus_title’,’Get in touch’);
   
   if ( !empty($zerif_contactus_title) ): echo ‘<h2 class=”white-text”>’.pll__(‘
   zerif_contactus_title’).'</h2>’; endif;
 * IT WORKS 🙂
 *  Thread Starter [coralepuccini](https://wordpress.org/support/users/coralepuccini/)
 * (@coralepuccini)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800144)
 * Look the site: [http://www.mariojannitti.com](http://www.mariojannitti.com) 🙂
 *  [tipadei](https://wordpress.org/support/users/tipadei/)
 * (@tipadei)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800258)
 * Hi,
 * How could I get the subtitles to be translatable? I did this with the titles 
   and it worked, but when I tried the same thing for subtitles or the red/green
   big title buttons, it doesn’t do anything.
 *  [tipadei](https://wordpress.org/support/users/tipadei/)
 * (@tipadei)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800259)
 * also all the links on the front page take me to the default language pages. How
   can I put different links into the buttons?
 *  [vbnadeau](https://wordpress.org/support/users/vbnadeau/)
 * (@vbnadeau)
 * [11 years ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800265)
 * Is there another way than the plugin polylang?
 * I have the plugin qtranslate for english/french and it works on all my pages.
   
   But I also want to have 2 languages on the homepage (Big title, about us, contact
   us…)
 * Can someone help me please?
 *  [Alexandra](https://wordpress.org/support/users/alexandrastan001/)
 * (@alexandrastan001)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800266)
 * Hello.
 * We have read your request and someone will answer your question as soon as possible.
   
   Thank you for your patience!
 * Best regards,
    Alexandra
 *  [MariusG](https://wordpress.org/support/users/marius_codeinwp/)
 * (@marius_codeinwp)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800267)
 * Hello,
 * Sorry for the late answer, I believe we managed to find the issue and we’re working
   on the fix.
 * There were indeed some strings missing from wpml-config.xml
    If it helps, you
   can manually add strings to that file.
 * Best regards,
    Marius
 *  [danc77](https://wordpress.org/support/users/danc77/)
 * (@danc77)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800271)
 * the issue still exists, not all strings are picked up. and above solutions adding
   it to function.php actually breaks up installation with this message:
 * Fatal error: Cannot redeclare zerif_setup() (previously declared in /home/***********/
   public_html/wp-content/themes/zerif-lite-child/functions.php:27) in /home/***********/
   public_html/wp-content/themes/zerif-lite/functions.php on line 151
 * At moment no title and subtitle of sections is picked up for translation, widgets
   works as expected.
 * any solution at it?
 *  [MariusG](https://wordpress.org/support/users/marius_codeinwp/)
 * (@marius_codeinwp)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800273)
 * Hello,
 * Sorry for the inconvenience, I thought we managed to fix this. It seems not all
   missing elements have been fixed, we will further debug this.
 * Unfortunately I don’t have a working solution at the moment.
 * Best regards,
    Marius
 *  [kockatt](https://wordpress.org/support/users/kockatt/)
 * (@kockatt)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/#post-5800274)
 * Hello!
 * Did anybody succeed to resolve this translation issue?
 * thanks!
    Kata

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/page/2/?output_format=md)

The topic ‘Polylang strings in front-page.php’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/zerif-lite/1.8.5.49/screenshot.
   png)
 * Zerif Lite
 * [Support Threads](https://wordpress.org/support/theme/zerif-lite/)
 * [Active Topics](https://wordpress.org/support/theme/zerif-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/zerif-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/zerif-lite/reviews/)

## Tags

 * [language](https://wordpress.org/support/topic-tag/language/)
 * [pll_e](https://wordpress.org/support/topic-tag/pll_e/)

 * 17 replies
 * 11 participants
 * Last reply from: [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/polylang-strings-in-front-pagephp/page/2/#post-5800276)
 * Status: resolved