Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21670

    How do I add language/flags in the Propulsion sub menu (to the right)?

    I found a way to remove the cart, however I haven’t found a way to add the flags… :-/

    Am using the polylang plugin.

    <li class='no-translation lang-item lang-item-15 lang-item-da current-lang menu-item'><a href='http://URL/forside/'><img src="http://URL/wp-content/plugins/polylang/flags/da_DK.png" title="Dansk" alt="Dansk" /></a>
    <li class='no-translation lang-item lang-item-16 lang-item-en menu-item'><a href='http://URL/frontpage/'><img src="http://URL/wp-content/plugins/polylang/flags/en_US.png" title="English" alt="English" /></a>
    <li class='no-translation lang-item lang-item-17 lang-item-de menu-item'><a href='http://URL/de/'><img src="http://URL/wp-content/plugins/polylang/flags/de_DE.png" title="Deutsch" alt="Deutsch" /></a>

    Thanks :)

    #112667

    You can “hardcode” these links into header.php or you can insert following filter function at the very bottom of functions.php:

    function add_login_logout_link($items, $args)
    {
    if($args->theme_location == 'avia2')
    {
    $newitems .= $items;
    $newitems .= '<li class="no-translation lang-item lang-item-15 lang-item-da current-lang menu-item"><a href="http://URL/forside/"><img src="http://URL/wp-content/plugins/polylang/flags/da_DK.png" title="Dansk" alt="Dansk" /></a>';
    $newitems .= '<li class="no-translation lang-item lang-item-16 lang-item-en menu-item"><a href="http://URL/frontpage/"><img src="http://URL/wp-content/plugins/polylang/flags/en_US.png" title="English" alt="English" /></a>';
    $newitems .= '<li class="no-translation lang-item lang-item-17 lang-item-de menu-item"><a href="http://URL/de/"><img src="http://URL/wp-content/plugins/polylang/flags/de_DE.png" title="Deutsch" alt="Deutsch" /></a>';
    }else{
    $newitems .= $items;
    }
    return $newitems;
    }
    add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How do I add language/flags in the Propulsion sub menu (to the right)?’ is closed to new replies.