Skip Navigation

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

Problem:
If you're experiencing issues with the CSS class in the Nav Menu Widget from Royal Addons for Elementor when using WPML, there are a couple of workarounds you can try.
Solution:
Workaround 1:
Disable the menu language switcher and instead use a Custom Language Switcher Shortcode inside an Elementor Shortcode Widget. The shortcode is:

[wpml_language_selector_widget]

. To enable and customize this shortcode, go to WPML -> Languages page and adjust the settings in the Custom Language Switcher section.

Workaround 2:
Modify the plugin file at

.../wp-content/plugins/royal-elementor-addons/modules/nav-menu/widgets/wpr-nav-menu.php

. On line 1698, change:

//add_filter( 'walker_nav_menu_start_el', [ $this, 'custom_menu_items' ], 10, 4 );

Additionally, on line 1656, replace:

$output ='<a href="'. esc_url($item->url) .'" class="'. esc_attr($item_class) .'">'. esc_html($item->title);</a>

With:

$output ='<a href="'. esc_url($item->url) .'" class="'. esc_attr($item_class) .'">'. wp_kses($item->title, array( 'span' => array() ));</a>

If these solutions do not resolve your issue or if they become outdated, we recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If necessary, please open a new support ticket.

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.

Tagged: ,

This topic contains 5 replies, has 2 voices.

Last updated by Andreas W. 10 months, 2 weeks ago.

Assisted by: Andreas W..

Author Posts
June 11, 2024 at 2:58 pm #15727566

alexandreN-10

hello Andreas i hope you are doing well big thanks for the support the problem is solved but there is one simple issue can you take a look on navbar assist us again i think it lacks the css class

June 11, 2024 at 6:02 pm #15728563

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

This is an issue between the Nav Menu Widget from Royal Addons for Elementor and WPML.

Workaround 1:

Disable the menu language switcher and use instead a Custom Language Switcher Shortcode inside an Elementor Shortcode Widget.

The shortcode is:
[wpml_language_selector_widget]

To enable and customize the output of this shortcode, go to the WPML -> Languages page and use the settings in the Custom Language Switcher section.

Workaround 2:

In wp-content\plugins\royal-elementor-addons\modules\nav-menu\widgets\wpr-nav-menu.php on line 1698 change:

add_filter( 'walker_nav_menu_start_el', [ $this, 'custom_menu_items' ], 10, 4 );

To

//add_filter( 'walker_nav_menu_start_el', [ $this, 'custom_menu_items' ], 10, 4 );

The issue occurs inside the plugin's Nav Walker Class which can be found at:

wp-content\plugins\royal-elementor-addons\modules\mega-menu\walkers\class-wpr-main-menu-walker.php

Until now I can not confirm any issues that might occur when using this workaround, but I suggest using the first workaround in case the second recommendation does not suit your needs.

I am sadly not able to identify what is causing this issue inside this Class.

The issue has been escalated to our compatibility team and I will contact you again once I receive internal feedback.

Best regards
Andreas

June 12, 2024 at 8:06 am #15729791

alexandreN-10

okay i am waiting your response

June 12, 2024 at 10:38 am #15730946

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Thank you for your message!

I will inform you once I receive feedback from our team.

June 13, 2024 at 5:51 pm #15737502

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Here the final workaround/fix:

Open .../wp-content/plugins/royal-elementor-addons/modules/nav-menu/widgets/wpr-nav-menu.php file.

Look for line 1656.

Replace this line:

				$output  ='<a href="'. esc_url($item->url) .'" class="'. esc_attr($item_class) .'">'. esc_html($item->title);

With:

				$output  ='<a href="'. esc_url($item->url) .'" class="'. esc_attr($item_class) .'">'. wp_kses($item->title, array( 'span' => array() ));

We will try to reach the author of "Royal Elementor Addons" to solve this issue.

Best regards
Andreas

June 19, 2024 at 12:20 pm #15755578

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

The author of Royal Addons for Elementor is asking us to forward this e-mail to you:

royalelementoraddons@gmail.com

Please reach out and they will be glad to assist you on this matter.

Best regards
Andreas