WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Polylang - Multilingual social icons? (16 posts)

  1. djek
    Member
    Posted 1 year ago #

    Hello, I am using polylang with responsive theme. My site is available in 3 languages: English, French & Dutch.

    http://lacamillette.fr

    Everything works great -:) However there is one thing I'd like to improve: my theme includes the option to have social icons on the top of the home page.

    I have setup 3 different Facebook fanpages, (EN, FR & NL). On my homepage I have created 3 different facebook icons.

    Is it possible to have only one facebook icon and, depending on the active language, redirect to the correct facebook fanpage?

    FYI, the social icons are stored in a specific folder of the responsive theme.

    Thanks a lot for any suggestions.

    Jacques

    Permalink settings:/%postname%
    Static homepage = no

    http://wordpress.org/extend/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, the responsive theme is well adapted to multilingual plugins. But the author chose not to translate the social icons options.

    The easiest way to do what you want is to edit the file wpml-config.xml in your theme folder. You will see a line like:
    <key name="featured_content" />
    Add this line just below:
    <key name="facebook_uid" />
    It works the same way for other social icons.

  3. djek
    Member
    Posted 1 year ago #

    Hi Chouby,

    Thanks for your reply. I added the line to the theme's wpml-config.xml file as you suggested. Actually I am using a child theme of the responsive theme, so I copied wpml-config.xml to the child theme's folder.

    My next question is: where do I find the option in the admin interface to specify a different facebook fanpage link for each language?

    Should I see this option under 'strings translation'? Should it show up in the responsive theme social icons options? or do I need to add another line of code somewhere?

    Thanks a lot,

    Jacques

  4. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    It should be in strings translations (only once you filled the original link in the theme options).

  5. djek
    Member
    Posted 1 year ago #

    Ok I tried that but the facebook icon still doesn't sthow up as an option under strings translation.

    I did a test with another key, in this case; 'featured content'. Indeed as soon as I entered some text, the strings translation entry should up inmediatetely.

    I guess the problem lies in the fact that the key name facebook-uid is not recognized.

    Can I just add the string manually in a table in the database?

    Just if this might help, here is the contents of my wpml-config.xml.

    Thanks for any further suggestions.

    Jacques

    <wpml-config>
        <admin-texts>
            <key name="responsive_theme_options">
                <key name="home_headline" />
                <key name="home_subheadline" />
                <key name="home_content_area" />
                <key name="cta_url" />
                <key name="cta_text" />
                <key name="featured_content" />
    		        <key name="facebook_uid" />
            </key>
        </admin-texts>
        <language-switcher-settings>
            <key name="icl_additional_css">#widgets ul li a { display:block; }</key>
        </language-switcher-settings>
    </wpml-config>
  6. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    It's strange because it's exactly what I tested and it works perfect for me. I took the name of teh option in the file footer.php of the theme.

  7. djek
    Member
    Posted 1 year ago #

    Ok I see. Just FYI, I changed the social icons from showing up in the footer, to show up in the header instead. Not sure if this would make any difference though.

    I will also double check with the forum of the responsive theme.

  8. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    How did you modify the theme?

  9. djek
    Member
    Posted 1 year ago #

    Hi Chouby,

    I modified the theme according to these instructions provided by the theme author in the forum:

    http://themeid.com/help/discussion/564/moving-the-social-icons

    Basically it consists of copying the code from the footer to the header php file.

    kind regards,

    Jacques

  10. Ulrich
    Member
    Posted 1 year ago #

    Hi Chouby,

    Do you support the wpml-config.xml in both in a child theme and parent theme?

    @djek Place the wpml-config.xml in the child theme and then delete the version in the parent theme. After a few refresh's it should work.

    Ulrich

  11. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, Polylang should support wpml-config.xml in both child and parent theme. But a bug is always possible. Here is the code (in wpml-compat.php) that I use to test the existence of both files:

    // child theme
    if (($template = get_template_directory()) != ($stylesheet = get_stylesheet_directory()) && file_exists($file = $stylesheet.'/wpml-config.xml'))
    	$this->xml_parse(file_get_contents($file));
    
    // theme
    if (file_exists($file = $template.'/wpml-config.xml'))
     	$this->xml_parse(file_get_contents($file));
  12. djek
    Member
    Posted 1 year ago #

    Hi guys,

    Thanks for your support. I have tried the following steps but still no luck )-:

    - removed wpml-config.xml from parent theme
    - now the file only exists in the child theme
    no visible translation strings translation option in polylang settings.

    I did another test:

    - I added some text to featured content within the responsive theme options.
    - I refreshed the page and it shows up immediately in the strings translation page.

    My conclusion is that the key name 'facebook_uid' is not recognized by polylang. btw I have also tried other social icon uid's such as twitter, linkedin etc.

    Is there a way to add this key manually to a database file?

    Thanks a lot for any other suggestions.

    Jacques

  13. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Could you try the old way (used before Polylang was able to read the wpml-config.xml file) ? http://pastebin.com/0Aw0wDaD
    add 'facebook_uid' to the array $strings in the code.

  14. djek
    Member
    Posted 1 year ago #

    Thanks for this suggestion. I would like to try it but..

    where should I add this code?

    In polylang.php?
    in the child theme functions.php?

    Thanks a lot,

    Jacques

  15. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry. I was not precise enough. You can either copy everything in a new php file that you upload in your plugins directory (and then activate the newly created plugin). Or you can copy the code from line 10 (add_action...) in your child themee functions.php

  16. djek
    Member
    Posted 1 year ago #

    Bingo! That worked -:). Thanks a lot! I really appreciate that you haven't given up but instead kept on offering new ideas to try to solve this problem.

    It may seem a small issue but it makes a big difference for the usability of my site. http://lacamillette.fr

    The solution was to create a new php file as you suggested and to add the facebook_uid to the array.

    Thanks a again!

    Jacques

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic