WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ngoran.ahoua
    Member
    Posted 1 year ago #

    Hello,
    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!

    http://wordpress.org/extend/plugins/multisite-language-switcher/

  2. realloc
    Member
    Plugin Author

    Posted 1 year 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 (); ?>
    <select>

    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>',
            $url,
            ( $current ? ' selected="selected"' : '' ),
            $link
        );
    }
    add_filter( 'msls_output_get', 'my_msls_output_get', 10, 3 );

    Hope this helps.

    Cheers,
    Dennis.

  3. ngoran.ahoua
    Member
    Posted 1 year 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. realloc
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year 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 :

    website

  6. realloc
    Member
    Plugin Author

    Posted 1 year 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:

    http://stackoverflow.com/questions/5150363/onchange-open-url-via-select-jquery

  7. ngoran.ahoua
    Member
    Posted 1 year ago #

    Ok,Thank you for your availability and your help!

  8. bermick
    Member
    Posted 7 months ago #

    Hi,

    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. realloc
    Member
    Plugin Author

    Posted 7 months ago #

    Do you have a link where I can see this?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic