Polylang and the Customizr theme

EDIT May 14th, 2014: I am glad to announce that ElectricFeet now proposes a complete guide on how to make Polylang and Customizr working together. He proposes a better code snippet, including compatibitility with Featured Pages Unlimited.

During the past days, I received a lot of support requests asking how to make mutlilingual the front page of the popular theme Customizr. So here is a simple custom plugin to make this happen.

1. Open a text editor (such as notepad) and paste the code below:

Plugin Name: Polylang Customizr
Description: Makes Customizr frontpage multilingual with Polylang
License: GPLv3

if (defined('POLYLANG_VERSION'))
add_filter('option_tc_theme_options', 'pll_tc_options');

function pll_tc_options($options) {
$areas = array('one', 'two', 'three');
if (is_admin()) {
pll_register_string('tc_featured_page_button_text', $options['tc_featured_page_button_text'], 'Customizr');

foreach ($areas as $area)
pll_register_string('tc_featured_text_'.$area, $options['tc_featured_text_'.$area], 'Customizr', true);

else {
$options['tc_featured_page_button_text'] = pll__($options['tc_featured_page_button_text']);

foreach ($areas as $area) {
$options['tc_featured_text_'.$area] = pll__($options['tc_featured_text_'.$area]);
$options['tc_featured_page_'.$area] = pll_get_post($options['tc_featured_page_'.$area]);

// filters sliders by language
$pll_options = get_option('polylang');

if (!empty($options['tc_sliders']) && $pll_options['media_support']) {
foreach ($options['tc_sliders'] as $slider => $images)
foreach ($images as $key => $img)
if (!(($id = pll_get_post($img)) && $id == $img))

return $options;

2. Save as pll-customizr.php
3. Upload the file pll-customizr.php in your wp-content/plugins directory
4. Activate the plugin “Polylang Customizr” in WordPress backend

You now just have to translate your featured pages as usual and translate your featured text in Polylang strings translations table. The slider will also be filtered by language if you activated the languages and translations for media in Polylang settings.

Important: for the moment it works only if the language is set from url (directory, subdomain or domain name).


35 thoughts on “Polylang and the Customizr theme

  1. Pingback: WordPress 佈景主題 | 狒吠

  2. diZturbio

    Thanks for this handy code snippet and instructions. I have managed to implement it with minor modifications (I only wanted to display two featured pages, so I removed the ‘third’ page from the array), however it doesn’t translate the costumized text I set for the buttons. Could you point me in the right direction as to establish some sort of “translation string” for polylang to deal with those buttons?

      1. diZturbio

        The updated code works wonderfully, thank you very much! Were the strings for translating the featured text already being added in the previous version or did you also introduce that with this code revision? Because I don’t recall having seen them there before, I had solved that by editing Customizr’s class-content-featured-pages.php to use custom page meta fields I could set differently for each page’s localized version; but this way everything is a lot more tidy, thank you again. 🙂

      2. diZturbio

        Yeah, meanwhile I figured out that they weren’t showing up on Polylang’s translation strings before, because of the edits I had done to Customizr’s featured pages class, but once again, thank you for the quick replies.

  3. Rúben

    Hi! You said it only works if language is set by url. By that you mean that it won’t work if the permalinks are shown the default wordpress way? The problem is that if I set different way of dealing with permalinks it breaks the links in Customizr.

    1. Frédéric Post author

      I mean that you have to use pretty permalinks and use the option “The language is set from the directory name in pretty permalinks” in Polylang settings (it should also work with subdomains). These are not the default options of WordPress and Polylang.

  4. younghacker

    I think you need to insert some polylang filter into the class defined in class-content-featured_pages.php. I don’t understand how polylang works and how intercept moment when theme ask featured blocks.
    Somewhere in that place need to owerride function, I think. I have no experience in WP programming.
    function __construct () {
    self::$instance =& $this;
    add_action ( ‘__before_main_container’ , array( $this , ‘tc_fp_block_display’), 10 );
    add_action ( ‘__fp_single’ , array( $this , ‘tc_fp_single_display’ ), 10, 2);

  5. younghacker

    I need to display translation page of tree featured blocks. For every block I create a page on each language and assign featured image. Example http://lc-group.cz
    Featured blocks are forever displayed only on the one selected in Customizr theme language.

  6. younghacker

    Yes pll-customizr.php was installed and activated. But now.
    Yes! Sorry! Now I have updated Polylang on that site! Polylang update before was not appeared in the admin-panel. How it works perfect! Thanks a lot!

  7. Nuno Cernadas

    Hello guys and thank you for your effort in providing us with nice tools and plugins. I am learning now how to use WP and I really wanted to translate my feature pages. I think I did exactly what you instructed (installation procedure and permalinks change) but the only options regarding Customizr in the strings is to change the button text (tc_featured_page_button_text). What am I doing wrong? Why can’t I change the featured pages text?
    Thank you again for your patience!

  8. Viktor Nagy

    I try to activeate the plugin, but it says:
    Parse error: syntax error, unexpected ‘if’ (T_IF) in /var/www/willisits.com/wp-content/plugins/pll-customizr.php on line 8

  9. Magnus


    Thanks for this snippet. I works great. But what about the slideshow? I have been reading on the internet but haven’t found a solution yet, so I might as well ask here.

    In Customizr you add images to a slideshow and give the slideshow a name. Is there a way to show one slideshow for one language and one slideshow for another language?

    Or can I turn on Polylang’s media handling and add let’s say four images to 1 slideshow (that I choose to present on the front page in Customizr settings, and have 2 images in Swedish and 2 images in English? Will the 2 Swedish images run in the slideshow while the language in Swedish and the 2 English images run when the language is English?

    Best regards,

    1. Frédéric Post author

      Yes, languages and translations management must be activated for media. You create only one slider common for all languages. You add as much pictures as you want, not necessarily the same for all languages. Polylang will then filter pictures according to the chosen language.

      1. Magnus

        Worked like a charm! Thank’s very much. I will donate when the customer accepts the multilingual solution. Best regards!

  10. María Lobo

    Hi! First of all, thanks so much for your work and support!
    I have the same problem as Viktor, I follow your instructions but when activating the plugin, I have the message: “Parse error: syntax error, unexpected T_IF in /home/somosgingko/www/wp-content/plugins/pll-customizr.php on line 8”.
    So if I had a problem while copying the code, how can I solve it? How could I know where the error is? I copied the code directly from this page (copy-paste).
    Thanks for your help!

    1. Frédéric Post author

      That’s rather strange, because I remade the test (with a copy paste of this page too) and got no parse error. What text editor are you using? Did you check that all lines before line 8 are exactly copied?

  11. George Papadopoulos

    Thanks! Great work. I face a strange problem. I am new with WP, and I probably do something wrong.

    I use 7 items on “Featured pages number” (I have customizr theme purchased), but the translation works only for the first three “Home featured pages”, and not for the “Custom featured pages” (4-7)!

    Thanks for your help!

    1. Frédéric Post author

      Clearly, at line 12, I defined only 3 areas. There was only 3 when I did write this code snippet. If there are more areas now, try modifying the line 12.

      1. George Papadopoulos

        I already tried this, but with no success. I think that the problem is that the first three areas are named as “Home featured page one/two/three” and the rest as “Custom featured page 4-7”.

      2. Frédéric Post author

        I believe that I understand now… Are you using the extension? If that’s the case, I am sorry but I can’t help you as I don’t have access to the code. Maybe you can try to ask to the theme author. I already made the bridge for the free version, so it should not be that hard for him to do the same for the extension.

      3. George Papadopoulos

        Yes, I use this paid extension. I finally not use polylang and I now use qtranslate. It is much easier I think, and has no such problems, at least for now 🙂

        Thanks for your answer!

  12. Sebastian


    I’m a bit lost, being a novice on this, working my way through with you guys great description and work, but I still have an issue I can’t seem to be able to solve:

    I just don’t find a plug-in called Polylang Customizr to activate.

    I did exactly as described above (used apple text edit, but normally works great for my minor php editing), uploaded the pll-customizr.php file into the plugin folder (also tried to create a sub-folder and direct upload into plug-in via zip-installation).

    If you’d have some quick advise it would be great.

    Cheers from Germany,

Comments are closed.