Tagged: x
-
AuthorPosts
-
January 5, 2017 at 5:12 pm #1317962
begeistertParticipantHello Community,
as many struggle with this question as I, but there is no answer for this specificly I ofen a thread now.
Problem description:
How is it possible to have different menues (primary 1, primary 2 on 2nd site) in one menu position in x-theme (e.g. primary menu) while having WPML for multilingual sites running too?Restrictions:
# WPML allows there configurable menu swapper in one of the menues. Otherwise you have to code it.So as WordPress coder I thought it would be easy to get this done. But no.
How far I am:
1)
You have to enter a new menu item to all menues listed in the primary location (or wherever you want to).
Here comes teh snippet for function.php in yout child theme folder (hopefully you set x theme up as child theme):function wpml_add_menu_item( $items, $args ) { $theme_locations = array( 'primary'); // or in more then one locations: 'secondary', 'footer-menu', 'sidebar-menu' (Name as in Theme) if( !empty( $args->theme_location ) && in_array( $args->theme_location, $theme_locations ) ) { ob_start(); ?> <li class="menu-item x-menu-item"><?php echo do_action('icl_language_selector'); ?></li> <?php $items .= ob_get_contents(); ob_end_clean(); } return $items; } add_filter('wp_nav_menu_items', 'wpml_add_menu_item', 10, 2);2) Ok. If you have done this you will recognise, that it looks not theme like. If you would use the integated language swapper for only one menu the style looks like your menu style (see screenshot 1 vs. 2).
So the question is:
How to design this line of code to let the menue swapper looking like our beloved x theme menu?
<li class="menu-item x-menu-item"><?php echo do_action('icl_language_selector'); ?></li>Any suggestions?
Thank you for helping.
screen1: should look like this – in all menus – like menu is formatted in x theme
screen2: is how it looks like with code above.January 5, 2017 at 11:38 pm #1318417
Rue NelModeratorHello There,
Thanks for writing in! Please do not select the menu items as a drop down. To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / passwordDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thank you.
February 15, 2017 at 3:22 pm #1372491
begeistertParticipantThis reply has been marked as private.February 15, 2017 at 11:56 pm #1373057
LelyModeratorHi There,
Thank you for the credentials.
Look for this line:
<li class="x-nav"><?php echo do_action('icl_language_selector'); ?></li>
Remove this part:class="x-nav"
Should be like this:
'<li><a href="#"><img class="wpml-ls-flag" src="http://x.compatibility.wpml.org/wp-content/plugins/sitepress-multilingual-cms/res/flags/en.png" alt="en" title="English"><span class="wpml-ls-display">English</span></a>'.do_action('icl_language_selector').'</li>';Now this part:
do_action('icl_language_selector')should only displayed the dropdown for switcher.
Please refer to the following link:https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/What you wish to achieve is only doable through custom development and we’re unable to provide that since WPML is a 3rd party plugin. You can create custom switcher that you could at your custom menu, like from here https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/
Hope this helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1317962 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
