WordPress.org

Forums

Polylang
[resolved] Different home slogans for different lanuages in Attitude theme (12 posts)

  1. herz84
    Member
    Posted 11 months ago #

    Hi,

    I just created a multi-language website using the Polylang plugin v.1.5.4 (www.patriciaverhagen.nl, add /en for the English version). The issue I’m facing now has to do with the home slogan (text in the grey bar below the picture) in the Attitude theme. How do I use a Dutch slogan for the Dutch website, and an English slogan for the English website? Right now, I don’t see the option to insert different slogans dependent on the language. Please advice.

    Thanks in advance!

    Cheers,
    Mirjam

    https://wordpress.org/plugins/polylang/

  2. tanver
    Member
    Posted 11 months ago #

    You can use something like
    if($currentlang=="en-CA"): ?>

    at an appropriate location in your themes header.php to test the current language and act accordingly.

  3. herz84
    Member
    Posted 11 months ago #

    Thanks for your reply, but can you please be more specific on what & where I should use the code you're suggesting? I'm not that familiair with PHP.

    Thanks!

  4. tanver
    Member
    Posted 11 months ago #

    I am sorry for the late response as I failed to note this message before. You need to use it in your themes header.php file, replacing the code used to display the logo.

    Always use child themes to implement such changes, they help you keep the original theme files safe and more importantly you can update them without ever fearing of getting your changes overwritten.
    Thanks!

  5. Seb81
    Member
    Posted 11 months ago #

    I'm not sure but if I understood correctly you can as well create a xml file making that option translatable within polylang language/strings page.

    Although that issue with Attitude theme has been discussed here on WPML forum : http://wpml.org/forums/topic/attitude-theme-making-the-home-page-slogan-theme-options-translatable/
    And it seems wpml team rewrote the header of the theme to make it work properly.

    Anybody with better knowledge than me might be able to tell from http://pastebin.com/e7w8RC8B if the xml is the easy solution, as option's name seems clearly visible.

    The solution provided by Tanver would work too, but you would need to 'hardcode' your slogans within a file, and do that for each changes... I tend to end up doing things like that too, as I'm not able to set correct solution, so I won't blame his solution more than I can afford to :) Although a proper solution imply to be able to set slogans from the admin, not editing files each time.

    Hope a skilled wordpressor will give you a hand, peace.

  6. herz84
    Member
    Posted 10 months ago #

    Sorry for the late reply, but Seb81, you saved the day! The solution provided by the WPML forum works perfectly for the Attitude theme and the Polylang plugin. Thank you so much for sharing!

  7. jamesnorris
    Member
    Posted 9 months ago #

    Dear herz84 I am having exactly the same issue. Could you please explain what steps you took. I also have Attitude and am using a child theme. I am not sure how to go about making the changes referred to in the WPML forum.

  8. herz84
    Member
    Posted 9 months ago #

    Hi James,

    I just followed the steps provided in the WPML forum (http://wpml.org/forums/topic/attitude-theme-making-the-home-page-slogan-theme-options-translatable/):

    I added the icl_translate function in the file: /attitude/library/structure/header-extensions.php in lines 388 and 391.

    I also commented the set_transient function that your theme uses. Changed function: http://pastebin.com/e7w8RC8B

    You can now translate that into the String Translation. Note that you need to write these slogans in English: Appearance > Theme Options > Advanced Options.

    So then you can translate it to other languages​​.

  9. jamesnorris
    Member
    Posted 9 months ago #

    Thank you for your help. I suppose I was just looking for a bit more detail. EG how to add the icl_translate function to my child theme. And I am not sure what "commented" means. Could you possibly set out in more basic steps how to achieve this? I appreciate any help.

  10. herz84
    Member
    Posted 9 months ago #

    I can help you, but not now (I'm at work :-p). Will write down in more detail tonight okay?

  11. jamesnorris
    Member
    Posted 9 months ago #

    Thank you I really appreciate your help. FYI the site is http://chaletjordan.com

  12. herz84
    Member
    Posted 9 months ago #

    Sorry, totally forgot yesterday. But here's what I did:

    - Browse in your FTP-program to /wp-content/themes/attitude-child/library/structure (I named my child-theme 'attitude-child', that might be different at your site) and open the file 'header-extensions.php' (make a copy of the file in advance on your local hard drive to be sure)
    - Copy the code from the pastebin-link above. Replace the code in the 'header-extensions.php' file on lines 376 to 401 with the copied code from the pastebin-link and save the file.
    - if you go to the admin-section of your website, browse to Settings > Languages. Choose the second tab ('translations'). If you scroll down, 2 new fields should appear now: wpml_custom_slogan1 and wpml_custom_slogan2. At wpml_custom_slogan1 you can fill out a (in your case) French version of the home slogan :-).

    Hope this explanation works for you! Good luck!

Reply

You must log in to post.

About this Plugin

  • Polylang
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic