Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of setting up wordpress multilingual navigation

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to set up wordpress multilingual navigation. I hope you will learn a lot after reading this article. Let's discuss it together.

By default, WordPress does not provide the ability to create multilingual sites, however, we can add multilingual capabilities to our WordPress site through plug-ins or online translation services. For individuals or companies that want to do international business, it is essential to add multilingual content to the site. The characteristic is that many WordPress websites that do foreign trade business often need to create content in several languages. Let's discuss how to develop a WordPress multilingual website.

The first method: create a multilingual site through the WordPress multilingual plug-in

Among the WordPress multilingual plug-ins, WPML is the earliest and most powerful, followed by Polylang, which is just as powerful, easier to set up than the WPML plug-in, and then qTranslate. Let's first take a look at how to create a multilingual site using the Polylang multilingual plug-in.

Step 1: add a language

After the Polylang plug-in is installed, add the language to the settings in the "Settings > language place" setting options.

Step 2: add a translation to an existing article

In the edit article interface, click the "+" sign at the multilingual setting, then jump to a page where the article is published in the appropriate language, and start adding the corresponding version of the language.

Step 3: add a language switching tool to the main navigation menu

Polylang also provides us with a language switch that can be added through the main navigation menu or sidebar.

The second method is to create multilingual sites through the WordPress Muiltisite multi-site network

Strictly speaking, this approach does not actually create a multilingual WordPress site, but it is the same as using the Polylang plug-in to create a multilingual website. And multiple languages are independent of each other. Site content can be different in multiple languages, which is different from using Polylang plug-ins. When using a multi-site network to create a multilingual site, it is recommended that you install it using a subdomain name.

Use the same theme, different databases

Sites in a multi-site network can share the same WordPress theme, which provides great convenience when we use a multi-site network to create a multilingual site. You only need to develop an international theme, which is used in subsites in various languages, and displays the corresponding language according to the language of different subsites. The fixed strings in the theme only need to be translated into the corresponding language using poedit.

Display language switching tools in multilingual sites created using multi-site networks

In multilingual sites created using multi-site networks, language switchers need to be implemented by ourselves. The idea is simple: determine the language of the current site, and then replace the second-level domain names of various languages with the php string replacement function, as shown in the following example.

$lang = get_locale (); / / return the language code of zh_CN or en_US $link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; / / get the complete current URL $en_link = str_replace ('http://cn',' http://www', $link); $cn_link = str_replace ('http://www',' http://cn', $link)

If we want to make it easier to manage, we can use the MultilingualPress multilingual site plug-in to manage the association between subsites in different languages, which is very convenient to associate the content between subsites in different languages through a lightweight interface.

Summary

Each of the two methods has its own characteristics, as for which method is better, there is not an absolute conclusion, which method to use to develop WordPress multilingual websites, according to the content of multilingual websites, if each article has a corresponding multilingual version, it is undoubtedly more convenient to use Polylang plug-ins, if the content of each language is different, then the way to use WordPress Muiltisite will be more appropriate.

After reading this article, I believe you have a certain understanding of the method of setting up wordpress multilingual navigation, want to know more about it, welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report