Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #62194

    Stefan T
    Participant

    Hi,

    I’ve searched through the forum and others as well and I haven’t found a solution yet. I’ve even tried to alter the footer.php file in multiple ways.

    I have a website and it´s in two languages. I can´t manage to translate the text in the footer content so that I can have it in two languages. Is there any way to do that?

    Thanks!

    #62545

    Rad
    Moderator

    Hi Stefan,

    Thank you for writing in!

    You will have to add translation function manually at wp-footer.php

    1. Copy wp-footer.php from /x/framework/views/integrity/ to /x-child-integrity-light/framework/views/integrity/
    2. Edit your copied wp-footer.php and find this line of code :

    <?php echo get_theme_mod( 'x_footer_content' ); ?>

    and change it into :

    <?php echo pll__(get_theme_mod( 'x_footer_content' )); ?>

    3. Add this code at your child theme’s functions.php

    pll_register_string('Footer Translation', get_theme_mod( 'x_footer_content' ) , true);

    4. Save and upload.

    5. Go to Polylang string translation and translate it.

    Hope this helps.

    #62728

    Stefan T
    Participant

    Thank you so much for the help!

    #62942

    Christian
    Moderator

    You’re welcome Stefan.

    #295224

    b_freund
    Participant

    Hi,

    can you please help me to implement the solution given in this thread with the current versions of X (4.0.1) and polylang? Here is what i tried:

    Since I couldn’t find “get_theme_mod” in the wp-footer.php, I figured the function has been replaced by “x_get_option”. So I modified the wp-footer.php of the child theme as suggested above, but with “x_get_option” instead of “get_theme_mod”.

    I then took it from the polylang documentation that “pll_register_string” now has an additional (third) parameter. So I added the following line to the functions.php of the child theme:

    pll_register_string('Footer Translation', x_get_option( 'x_footer_content' ) , 'polylang', true);

    However, this breaks the whole site. I may add that I have put some HTML-code in the Footer Content (basically, <b> and a link), but I believe that this should not be a problem, or am I wrong?

    Kind regards

    Bernhard

    #295498

    Rue Nel
    Moderator

    Hello There,

    Thanks for updating this thread! get_theme_mod is a WordPress function. You can check it here: https://codex.wordpress.org/Function_Reference/get_theme_mod

    Can you please post the contents of your wp-footer.php file? Just place it using the code tag. The footer content with html tags may be one of the reason why your site is broken. We’ll be happy to provide you with a response once we have a better understanding of the situation.

    Please let us know.