Support » Plugin: Polylang » Footer text in Customizer

  • In the theme I’m using (Hueman Pro), there is a field in the Customizer called “Footer Copyright Text”. The text I put in that field does not appear in String Translation. The field accepts HTML, but not PHP (I tried <?php _e('My Text'); ?> and it just disappeared).

    I first asked the theme support folks, but the reply was, “I don’t have enough knowledge of Polylang to answer your question. I’d recommend to contact polylang support to explain what you need to achieve : translating a theme option field.” Hmph! So here I am asking you. If there is something that the theme developer needs to do, let me know and I’ll pass it along.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter OsakaWebbie


    I found a solution or at least workaround. This article was very helpful:

    In Hueman Pro the relevant code in footer.php is this:

    echo apply_filters('hu_parse_template_tags', wp_kses_post( hu_get_option( 'copyright' ) ) );

    So I changed it to this:

    echo apply_filters('hu_parse_template_tags', wp_kses_post( function_exists('pll__') ? pll__(hu_get_option('copyright')) : hu_get_option('copyright') ) );

    The Kau-Boys article didn’t mention using using the function_exists conditional, but I didn’t want my site to break if Polylang is in a deactivated state.

    Then in functions.php I added this per the instructional page:

    if ( function_exists( 'pll_register_string' ) ) :
      function hueman_pro_child_pll_register_string() {
        pll_register_string( 'copyright_text', hu_get_option( 'copyright' ) , 'hueman-pro-child', true );
      add_action( 'after_setup_theme', 'hueman_pro_child_pll_register_string' );

    At that point the contents appeared in Polylang’s String Translation and I was able to write the translation.

    Because it’s a Polylang-specific function call, I guess I can’t really ask the theme developers to include it in the parent theme – presumably they would have to include the equivalent for each of various translation plugins. I know that Polylang supports WPML calls, but since the Kau-Boys article only talked about how to do it for Polylang, I wouldn’t know what the WPML equivalents would be. This works for me personally, so I guess that’s good enough. (I try to minimize the number of files in my child theme to reduce the chance of getting out of sync when the parent gets updates, and I didn’t need footer.php for any other reason, but c’est la vie.)

    If anyone who sees this thread can share a more universal solution that the theme developer could implement, do tell.

    • This reply was modified 1 year, 3 months ago by OsakaWebbie.
Viewing 1 replies (of 1 total)
  • The topic ‘Footer text in Customizer’ is closed to new replies.