WPML Language Switcher in menu not styled correctly

  • The WPML Language Switcher causes the navigation menu to resize. The sub-menu item is not represented like other regular sub-menu items.

    Here is a side-by-side comparison of a regular sub-menu item (under Contact) and the language switcher next to it:

    Regular sub-item vs. WPML sub-item

    To fix this problem:
    Add in Custom JS:
    <script type="text/javascript">jQuery('.navbar-nav').on('click', '.menu-item-language-current > a', function(e){e.preventDefault(); if(jQuery(window).width()<768){jQuery(e.currentTarget).parent().toggleClass('open');}});</script>
    Add in Custom CSS:
    .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    min-width: 160px;
    padding: 5px 0;
    margin: 2px 0 0;
    font-size: 14px;
    text-align: left;
    list-style: none;
    background-color: #fff;
    -webkit-background-clip: padding-box;
    background-clip: padding-box;
    border: 1px solid #ccc;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 4px;
    -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
    .open > .sub-menu {
    display: block;
    @media (min-width: 768px) {
    .navbar-right .sub-menu {
    right: 0;
    left: auto;
    @media (max-width: 767px) {
    .navbar-nav .open .sub-menu {
    position: static;
    float: none;
    width: auto;
    margin-top: 0;
    background-color: transparent;
    border: 0;
    -webkit-box-shadow: none;
    box-shadow: none;
    .navbar-nav > li > .sub-menu {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;

    .navbar-default .navbar-nav .menu-item-language-current li > a {
    line-height: 28px;
    border-bottom: none;
    margin-bottom: 0px;
    .sub-menu > li > a {
    display: block;
    padding: 3px 20px;
    clear: both;
    white-space: nowrap;
    .sub-menu > li > a:hover {
    color: #262626;
    text-decoration: none;
    background-color: #f5f5f5;
    @media (max-width: 767px) {
    .navbar-default .navbar-nav .open .sub-menu > li > a {
    color: #777;
    .navbar-default .navbar-nav .open .sub-menu > li > a:hover {
    color: #333;
    background-color: transparent;
    background-image: none;
    .navbar-default .sub-menu li a {
    margin-right: 0;
    .navbar-default .navbar-nav .active .sub-menu li > a,
    .navbar-default .navbar-nav li.current-menu-parent .sub-menu li > a,
    .navbar-default .navbar-nav li.current_page_parent .sub-menu li > a,
    .navbar-default .navbar-nav .menu-item-language > a {
    border-bottom: 0 !important;
    .navbar-default .navbar-nav ul.sub-menu li > ul.sub-menu {
    top: 0;
    left: 100%;
    margin-top: -6px;
    -webkit-border-radius: 0 6px 6px 6px;
    -moz-border-radius: 0 6px 6px;
    border-radius: 0 6px 6px 6px;
    .navbar-default .navbar-nav ul.sub-menu li:hover > ul.sub-menu,
    ul.sub-menu li:focus > ul.sub-menu {
    display: block;
    ul.nav li.menu-item-language-current > a::after {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    vertical-align: middle;
    border-top: 4px dashed;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
    content: '';
    @media (min-width: 980px) {
    ul.nav li.menu-item-language-current:hover > ul.sub-menu {
    display: block;


    Thank you for providing this. I will release an update in the next version.

    Basically duplicate all behavior (CSS and JS) for bootstrap’s “dropdown” and “dropdown-menu” selectors, and target “sub-menu” and “menu-item-language-current” (because I can’t append “dropdown” class to that LI without modifying theme templates and I don’t want to do that).


You must be logged in to reply to this topic.