Multisite Language Switcher
[resolved] Language display in a drop-down menu, and in the header. (9 posts)

  1. ngoran.ahoua
    Posted 3 years ago #

    My question is how to display in the header of my template, a drop-down menu of languages ​​(I have 9 different languages).
    I did go to this page "https://github.com/lloc/Multisite-Language-Switcher/wiki/Generate-the-output" as you indicated in this ticket "http://wordpress.org/ support / topic / flag-display-customization? replies = 2 "but I do not exactly know what code I should use? When I test with
      if (function_exists ('the_msls')) the_msls ();
    I have the choice of languages ​​is displayed but how to display the language list in a drop-down, with the current language as the selected item?(which codes should I use?)? Thank you for your help!


  2. Dennis Ploetner
    Plugin Author

    Posted 3 years ago #

    OK ... it's not that hard. ;)

    Insert some code - for example like this -

    <select id="msls_languages">
    <?php if (function_exists ('the_msls')) the_msls (); ?>

    in your header where you would like to have the drop-down. In your functions.php insert a function like this

    function my_msls_output_get( $url, $link, $current ) {
        return sprintf(
            '<option value="%s"%s>%s</option>',
            ( $current ? ' selected="selected"' : '' ),
    add_filter( 'msls_output_get', 'my_msls_output_get', 10, 3 );

    Hope this helps.


  3. ngoran.ahoua
    Posted 3 years ago #

    Thank you for your help, the solution works very well. but I do not have flags that appear :( is it possible to display " name + flag" in this drop-down menu?

  4. Dennis Ploetner
    Plugin Author

    Posted 3 years ago #

    An image in an option? I'm quite sure that this will not work in all browsers.

    I think you could accomplish this much easier if you would set the output-options of the plugin (please read https://github.com/lloc/Multisite-Language-Switcher/wiki/Settings) and then try to format the generated <ul> and the <li>s by this line of code

    <?php if (function_exists ('the_msls')) the_msls (); ?>

    with CSS.

  5. ngoran.ahoua
    Posted 3 years ago #

    Again thank you for your help! I will try to implement this solution.
    However I have a problem with the drop down menu: Links do not work. I can not switch between versions. I was able to do so as I do not utlisais menu. You know why?

    below a link :


  6. Dennis Ploetner
    Plugin Author

    Posted 3 years ago #

    Thanks for the link (BTW: There are images in the generated code of the drop-down. Please have a look at the html-code!).

    Yes, a drop-down like this does nothing. You could make use of a little bit of JavaScript. Maybe something like that:


  7. ngoran.ahoua
    Posted 3 years ago #

    Ok,Thank you for your availability and your help!

  8. bermick
    Posted 2 years ago #


    Great plugin you made, really helpful. But i dont manage to get it into the topbar. Ive already copied the <?php if (function_exists ('the_msls')) the_msls (); ?> text in the header.php and it is now displaying but id to doesnt have any links, the links are not working.

    Again: thanks a lot

  9. Dennis Ploetner
    Plugin Author

    Posted 2 years ago #

    Do you have a link where I can see this?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Multisite Language Switcher
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic