MultilingualPress External Sites support
Starting from version 4.3.0 of MultilingualPress, you can activate a module that links source posts from a subsite of the network that has MultilingualPress installed with a page on an external site.
Table of Contents
Setting up an External Site
First, proceed to the Network dashboard and access the MultilingualPress admin panel to activate the module (MultilingualPress Global Settings). As shown in the figure, select the External Sites checkbox on this panel and press the Save Changes button to activate the module.
Now, selecting the External Sites link on the left menu can access the External Sites section and create an external site link. In this case, we will create a link to an Italian newspaper site page.
If you wish to redirect the user to the external site automatically, the Redirection module must also be activated in the MultilingualPress settings.
Only in this case, the option for automatic redirection is visible in the External Site creation form, as depicted in the figure below.
Remember to select the “Enable Automatic Redirect” checkbox to allow automatic redirection to the External Site for all those users whose language matches the one set for the respective external site.
So, an External Site is defined by the following parameters:
- Site URL (required): Defines the URL of the external site where you intend to redirect the user.
- Site Language Name (required): The name you wish to give to the external link, either to edit it in the backend or to appropriately name the translation in the language menu.
- Site Language Locale (required): The locale for the language to which the external site is associated.
- Enable Hreflang: Using the hreflang attribute for language and regional targeting.
- Enable Automatic Redirect: The option to enable automatic redirection of the user; is visible only if the Redirect module has been activated in the MultilingualPress settings.
Finally, suppose the Enable Automatic Redirect option is activated in the MultilingualPress settings. In that case, a new select box is added to display the list of defined External Sites in the Redirection tab. You can select an External Site from this list to designate it as the fallback external redirection link, as shown in the picture below.
Referencing a post to an External Site
Suppose we have a page or a post created in one sub-site. If we head into the post in edit mode, we can see a new section with the MultilingualPress translation meta boxes where the defined External Sites are shown.
If no URL is specified in the field related to the External Site, the translation link will redirect the user to the URL defined in the MultilingualPress settings. If we want to define a specific URL, this can be done by filling in the field next to the related External Site name.
Adding an External Site to the language menu
After setting up the External Site redirection feature and properly assigning the link to a post, we need to add a new element in the language menu that lets us manually switch to the translation managed by the External Site.
Our original post, “India on the Moon,” is linked to an article on an external Italian site: We need to provide the language menu with an item that lets the user manually switch to that site. To do so, we update the menu as reported in the following image.
Pressing the Save Menu button, the menu is updated. The language menu lets users select the Italian External Site directly from the frontend.