Integration in Websites

Benutzung des Widgets

Wie bereits in Bearbeiten der Vebindungen von Inhalten beschrieben, kann man neben dem Hinweis auf eine existierende Übersetzung, ein Widget in jede beliebige dynamische Sidebar integriert werden.

Die Ausgabe ist abhängig von den gespeicherten Einstellungen des Plugins und dem CSS des verwendeten Themes, aber hier ein Beispiel der Ausgabe:

Using the shortcodes

Der Multisite Language Switcher bietet zudem zwei sogenannte Shortcodes an:

You can insert it into your posts or pages when you want to show a link to the alternative translation of the current content.


This is a shortcode that renders the widget output because there are themes that your widgets also have in that way.


Using the block

The last shortcode is also available as a block in the new Gutenberg editor. This is a first step because the UI is right now far from perfect.

Using the API

It is also possible to directly use the plugin features in your theme, you can use for example the following code in the header.php file of your WordPress theme.

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

MSLS comes with some additional API functions if you need the URL of a flag by URL for example. There is also the possibility to get the description of the blog and the permalink of the current content by language (locale):

$language    = get_locale();
$flag_url    = get_msls_flag_url( $language );
$description = get_msls_blog_description( $language );
$locale_href = get_msls_permalink( $locale );