Support » Plugin: Multisite Language Switcher » Group languages by continent

  • Resolved meneldil

    (@meneldil)


    Hello,

    I would like to know if it is possible to retrieve the translation url by specifying the ID of the blog?

    I would like to group the languages by continent, for example:

    <h4>North America</h4>
    <ul>
    	<li><a href="[link_us]">United States</a></li>
    	<li><a href="[link_ca]">Canada</a></li>
    </ul>
    <h4>Europe</h4>
    <ul>
    	<li><a href="[link_fr]">France</a></li>
    	<li><a href="[link_es]">Spain</a></li>
    	<li><a href="[link_uk]">United Kingdom</a></li>
    </ul>

    Thanks in advance.

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

    (@realloc)

    Hello,

    MSLS has the function get_msls_permalink(). You can pass a locale and get the link of the current page/post:

    <h4>North America</h4>
    <ul>
    	<li><a href="<?php echo get_msls_permalink( 'en_US' ); ?>">United States</a></li>
    	<li><a href="<?php echo get_msls_permalink( 'en_CA' ); ?>">Canada</a></li>
    </ul>
    <h4>Europe</h4>
    <ul>
    	<li><a href="<?php echo get_msls_permalink( 'fr_FR' ); ?>">France</a></li>
    	<li><a href="<?php echo get_msls_permalink( 'es_ES' ); ?>">Spain</a></li>
    	<li><a href="<?php echo get_msls_permalink( 'en_GB' ); ?>">United Kingdom</a></li>
    </ul
    

    Wonderful!
    Thank you very much! 🙂

    I called victory too quickly…
    The returned url is not the correct one.

    For example, if I am on the “en_US” site on the “About us” page:
    echo get_msls_permalink('en_US') returns the main domain:
    http://www.site.com

    echo get_msls_permalink('fr_FR') returns the url of the current page and not the page attached in administration:
    http://www.site.com/about-us instead of http://www.site.com/fr/a-propos.

    Where does the problem come from ?

    • This reply was modified 1 week, 3 days ago by meneldil.
    Plugin Author Dennis Ploetner

    (@realloc)

    Are those pages tied together?

    Yes, they are linked.

    Can you reproduce the bug?

    Plugin Author Dennis Ploetner

    (@realloc)

    I will check this in the next 2 days…

    Hello, don’t forget me. 😀

    Plugin Author Dennis Ploetner

    (@realloc)

    I tried it a lot of times and it works just fine. I developed the functionality for something my company needed. Just look for the flag in the footer of the page and click on it. It opens a list of other flags where that function is used: https://www.drivek.es/faq/

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.