Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This thread is resolved. Here is a description of the problem and solution.

Problem: The user was having issues with conditions of his menu in secondary language Solution: The plugin Conditional Menus presents some serious compatibility issues with WPML, the solution was pretty complexe and we have had to correct it in many steps: 1. https://wpml.org/forums/topic/bug-with-conditional-menus/#post-3138540 2. https://wpml.org/forums/topic/bug-with-conditional-menus/#post-3148567 3. https://wpml.org/forums/topic/bug-with-conditional-menus/#post-3164479 Check also https://wpml.org/forums/topic/bug-with-conditional-menus/page/2/#post-3173711

Tagged: 

This topic contains 17 replies, has 5 voices.

Last updated by jasonJ-4 9 months, 2 weeks ago.

Assigned support staff: Jamal.

Author Posts
January 24, 2019 at 11:09 pm

Puntorosso

Hi,

since one of the last updates, the plugin Conditional Menus from Themify isn’t working properly anymore with WPML. (it was working perfectly before)

If you assign a menu to a normal page it works in all languages, but if you assign it to a child page it works only in the main language.

Here a screencast:

hidden link

Steps to re-create the bug:

- Create a page and translate it.
- Create another page, assign the previous page as parent and translate it.
- Assign a menu which is not the default one to the new created pages.

Now you will see that the conditional menu shows only in the parent pages, but not in the translated child page.

Any idea what it can be?

I have already contacted the Themify support, but I thought it could also be a WPML bug.

Thanks

Best

Amadeus

January 25, 2019 at 3:55 pm
January 25, 2019 at 3:57 pm #3129731

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for contacting WPML Support. I will be glad to help with this.

I would love to hear what themify think about this. In the meanwhile i will suggest that you switch from the admin top bar to secondary language and try to update the conditions for the translated menu.

If this does not help, i have created a test server, please use credentials in the previous private message to login in, upload the Conditional menus plugin and recreate the issue. Then i will push this to our compatibility team to handle it.

Best regards,
Jamal
WPML Support

January 25, 2019 at 6:02 pm #3130194

Puntorosso

Hi, I have recreated the bug in your test environment.

hidden link

Best

January 28, 2019 at 8:49 am #3134351

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for your collaboration. I have escalated the ticket to our compatibility team, i will inform you about any progress as soon as possible. This may take a while depending on the team priorities.
Themify is already part of our Go Global Program, i hope this will take a short time to get resolved.
https://wpml.org/documentation/theme-compatibility/go-global-program/

Best regards,
Jamal
WPML Support

January 29, 2019 at 8:29 am #3138540

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for your patience. Our compatibility team has found a workaround to make the conditional menus working, i tested it on the sandbox and it worked.

1. You will need to install String Translation in your account https://wpml.org/account/downloads/
2. Go to Appearance->Menus and remove the old conditional rules in both languages (use the language switcher in admin topbar) some hosting providers like workdpress.com removes the language switcher.
3. Add this wpml-xml.config to your theme or following this article https://wpml.org/documentation/support/language-configuration-files/overriding-language-configuration-files/

<wpml-config>
    <admin-texts>
        <key name="theme_mods_twentyseventeen">
            <key name="themify_conditional_menus">
                <key name="top">
                    <key name="1">
                        <key name="menu"/>
                        <key name="condition"/></key>
                    <key name="2">
                        <key name="menu"/>
                        <key name="condition"/></key>
                </key>
            </key>
        </key>
    </admin-texts>
</wpml-config>

it should be customized per theme and menu.

3. Create the conditional rules for the menus in the default language only (add only the pages for the default language)
4. In WPML > String Translation > domain "admin_texts_theme_mods_twentyseventeen" or "admin_texts_theme_mods_{your_theme_slug}" you will find the conditions for each menu. They look like this:


post_type%5Bpage%5D%5B%2Fparent_page%2Fchild_page%2F%5D=on&post_type%5Bpage%5D%5Bparent_page%5D=on5

Translate the slugs inside that URL encoded string, like this:


post_type%5Bpage%5D%5Bparent_page_de%2Fchild_page_de%2F%5D=on&post_type%5Bpage%5D%5Bparent_page%5D=on&post_type%5Bpage%5D%5Bparent_page_de%5D=on

Please check the sandbox to see how it was performed, and let me know if you have any doubts.
Looking forward to your reply.

Best regards,
Jamal
WPML Support

January 31, 2019 at 2:13 pm #3148221

Puntorosso

Hi, sadly I don't have any "admin_texts_theme_mods_..........." in my String translator.

Thanks

Best

January 31, 2019 at 2:24 pm #3148295

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for your feedback, i wanted to check it and i found "String Translation" not activated, please activate it and let me check.

Best regards,
Jamal
WPML Support

January 31, 2019 at 2:35 pm #3148323

Puntorosso

I see it in your environment but not in my WP install I have sent you at the beginning of this ticket

January 31, 2019 at 3:27 pm #3148567

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for installing the String Translation, i checked it again and i found what's the issue. In this specific case, the menu location is not called "top" but primary i had to adapt the xml config and change


<key name="top">

To


<key name="primary">

Now the "admin_texts_theme_mods_twentythirteen" is available. See attached image.
I will let you complete the fix.

Looking forward to your reply.

Best regards,
Jamal
WPML Support

February 1, 2019 at 1:16 am #3150090

Puntorosso

Hi, yes now I can follow your workaround. Thanks you a lot for your effort.

While it works on the test site, it's sadly not usable for the live site.
There are too many conditions assigned to every menu, so that the strings to translate is huge (more than 2000 words)!

Do you think it could be updated so that I can use the normal plugin's interface?

Thanks

Best

February 1, 2019 at 1:25 pm #3151728

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank your for your feedback and my apologies for the late reply. I have informed our developers about your feedback and i will get back to you as soon as i have any news.

Best regards,
Jamal
WPML Support

February 6, 2019 at 8:37 am #3164479

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Can you please test this new fix. It is working on the sandbox server. And it does not involve String Translation or XML configuration. Please revert back the modifications you have already done.

You will need to update the Conditional Menu file "conditional-menus/init.php" and change lines 334-336 with this:

if( $post_type === 'page' && isset( $query_object->post_parent ) && $query_object->post_parent > 0 ) {
                            $current_lang = apply_filters('wpml_current_language', null);
                            $default_lang = apply_filters('wpml_default_language', null);
                            do_action( 'wpml_switch_language', $default_lang );
                            $query_object = get_queried_object();
                            $slug = str_replace( get_option('home'), '', get_permalink( $query_object->ID ) );
                            do_action( 'wpml_switch_language', $current_lang );
                        }

Then in default language you will need to add a condition to disable the menu when parent pages are accessed and another condition to show the second menu. Check the sandbox to see an example.

Let me know if you have any doubts implementing this fix.

Best regards,
Jamal
WPML Support

February 8, 2019 at 2:58 am #3173057

Puntorosso

Hi, thank you very much for your effort, I really appreciate it.
I see it's working on the test environment, but somehow I can't get it work on the live site.

Can you tell me exactly which code you changed in "conditional-menus/init.php"?

Also, I have removed the wpml-xml.config you suggested last time, but I still see the "admin_texts_theme_mods_{your_theme_slug}" in String Translation.

Shouldn't disappear?

Thanks

February 8, 2019 at 3:04 am #3173100

Puntorosso

To avoid errors, I have copied the init.php from the sandbox and disabled String Translation on the live site, but didn't helped.