• Hi Dennis,

    I remember your outstanding support when you helped me out last and wanted to thank you for the MSLS updates.

    I have dived into the configuration of MSLS output a bit more and I have understood the bit about defining an array of blogIDs that can be output, however I don’t have the skills to understand how to define in PHP a sort order for different ID’s.

    SO the ID’s are as follows:
    1= FR_fr, description = “Site Name | FR”
    2= EN_en, description = “Site Name | EN”
    3= AR_ar, description = “Site Name | AR”

    This would yield the following order:
    default (Using language codes); 3,2,1
    Using description sort order; 3,2,1
    but what I would like to have as the sort order is 1,2,3

    Any tips or tricks to modify the output according to my requirements?

    Cheers JP

    https://www.ads-software.com/plugins/multisite-language-switcher/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    You could use get_the_msls() and work with the returning array instead of printing the links directly. Would this resolve your problem?

    Cheers,
    Dennis.

    Thread Starter jappie11

    (@jappie11)

    Hi,

    Not sure but maybe I lack in understanding here, I was hoping to do something like this

    foreach ( array( 1, 2, 3) as $id ) {
    		 //array('orderby' => 'blog_id', 'order' => 'ASC');
    		 $arr[$id] = get_blog_details( $id );
        }
        //$arr = array('orderby' => 'blog_id', 'order' => 'ASC' );
    return $arr;

    Note: the commented out lines are attempts in vain to get the sort order optimized.

    In terms of using get_the_msls(), how would you go about to create a fully customized language switcher? How do I get the flags,
    li>items, etc. and most importantly, how do I set the sort order?

    Thanks in advance for your help!

    Cheers JP

    Plugin Author Dennis Ploetner

    (@realloc)

    Do you need just an array with the generated links so give it a try ??

    $arr = get_the_msls();
    print_r( $arr );

    Or do you need something else?

    Thread Starter jappie11

    (@jappie11)

    Ideally the output would be the same as with the_MSLS, so including the divs below. Also I noticed that the function example output the get_the_msls to the navigation menu, which is not what I want since it should have it’s own DIV.
    add_filter( 'wp_nav_menu_items', 'my_custom_language_menu', 10, 2 );

    How would I change the add_filter above to use get_the_msls with the divs I need in my header?

    The desired output is as follows:

    <div id="language_selector"><ul class="translation_links">
    
    <li><a href="#" title="fr"><img width="16" height="11" src=".../wp-content/plugins/multisite-language-switcher/flags/fr.png" alt="fr_FR"></a></li>
    <li><a href="#/en" title="en"><img width="16" height="11" src=".../wp-content/plugins/multisite-language-switcher/flags/us.png" alt="us"></a></li>
    <li><a href="#/ar" title="ar"><img width="16" height="11" src=".../wp-content/plugins/multisite-language-switcher/flags/ar.png" alt="ar"></a>
    </li>
    </div>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Plugin Author Dennis Ploetner

    (@realloc)

    Seems that this little functionality is a little bit more complex. Could be a variation of this here: https://github.com/lloc/Multisite-Language-Switcher/wiki/Use-the-blog-collection-in-your-functions-%28and-filters%29

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sort order’ is closed to new replies.