[Resolved] Hero Headers and WPML (Again)

Home Forums Support [Resolved] Hero Headers and WPML (Again)

Home Forums Support Hero Headers and WPML (Again)

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1471202
    Gary

    In an earlier post, I was able to get the Header Element on the Front Page recognised for non-default languages by changing the system field ‘_generate_hero_full_screen’ to ‘Copy’ instead of ‘Don’t Translate’.
    (see https://generatepress.com/forums/topic/header-element-and-wpml/ ).

    However, while this works for ‘Front Page’, it doesn’t work for any other pages.

    I have tried everything including adding functions mentioned in earlier posts such as here:
    https://generatepress.com/forums/topic/bug-elements-and-display-rules-and-wpml-wpml-global-locations-bug-ongoing/#post-662746 (where a potential bug is highlighted)
    and here: https://generatepress.com/forums/topic/how-change-page-hero-elements-text-for-pages-with-different-languages/

    These last two posts are relatively old so I suspect that updates to the code have already been implemented. Nevertheless, I worked through and made the suggested changed, but nothing worked.

    Let me give an example of where I am.

    I have a default language (English) page called ‘Accommodation’. The translated page (Chinese) is 怡保的住宿 (for simplicity in this post I will call in ‘Chinese_Accom’.

    My accommodation page is fully translated and works fine, except the header.

    The Elements Header is translated.

    I have tried the Element Header Display Conditions with just ‘Accommodation’ as well as ‘Chinese_Accom’.

    All the System Fields relevant to the Element are set to ‘Copy’.

    I really don’t know what else to do.

    When I inspect the code I find it instructive that the following line in on the ‘Accommodation’ page, but not the ‘Chinese_Accom’ page:

    <div class="page-hero hide-on-mobile full-height">

    For some reason it is not being called and I cannot work it out. This is happening for all my translated pages, except the Front Page.

    Any help would be really appreciated. Thanks, Gary

    #1471961
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Elements should work like any other post type (posts, pages, etc..).

    So you should have an English version of the Element, and a Chinese version of the Element – is that correct?

    You should also have two versions of each of your pages (English and Chinese) that should display in the Display Rules. The English version should target the English page, and the Chinese version should target the Chinese page.

    I’m not overly familiar with how WPML works, but my understanding is the above. It may be worth getting their thoughts on it as well in case I’m totally misinterpreting something.

    #1472746
    Gary

    Hi Tom,

    Yep…I have two versions of each of the pages (English and Chinese) as well as two versions of the Header Element (English and Chinese). The Display rules are setup in the default language Element (so I have two rules, one targeting the English page and the other targeting the Chinese page). It is not possible to setup Display Rules in translated Element as there is no option for that (only the translation of content).

    As you suggest, I’ll reach out to WPML and see if they can resolve it. I’ll let you know how it goes. Thanks, Gary

    #1472836
    Gary

    Ok. I have found the solution (but this isn’t recommended for pages that have content). On the Elements Admin Page, change the admin language to the language you want to target. Then click on the relevant Header and go into Display Settings. Add the page(s) of the translated content. Click Update.

    Note: You will be warned that this content has already been translated in the Translation Editor. Normally in such cases (especially with pages and posts), you would click ‘Go Back’ so as to not lose your content. However, in this instance click ‘Edit Anyway’, go to Display Setting, add the relevant location, and click update. You will once again get a warning. This time, click ‘Go Back’. You will see the warning again and once again click ‘Go Back’.

    The header should now be on the translated page(s).

    #1473444
    Tom
    Lead Developer
    Lead Developer

    Interesting – we’ll dig into this a bit to see if it’s something we can improve. Let us know if WPML has any suggestions as well.

    Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.