Method 1: Modify
Wordpress built-in language functions directly in the source code, __(), _e (), _x(), here we can directly modify the English part in the language function here, translate it into Chinese, and complete the Chineseization work.
For example: __( 'Newer Comments →', 'StyleShop' );
While directly replacing the English part, we should also consider the HTML tags and cannot modify them. HTML tags, otherwise it will destroy the integrity of the template.
As for how to quickly locate the parts that need to be Chineseized, here we can use Dreamweaver to help us quickly locate the parts that need to be Chineseized. First, you need to create a site. The site root directory needs to point to the Chinese WordPress template path. Use the shortcut key "CTRL+F", select the search range as "the entire current local site", enter the content you want to search, and click "Search All". Achieve quick location of the search content, and then Chineseize it. After the Chineseization is completed, be sure to save it. The author does not recommend this method here, because for novices, if they cannot distinguish which parts need to be Chineseized, it is easy to make mistakes and destroy the integrity of the template source code.
Method 2: Use Poedit software for Chineseization
1. There are language files in the template
Generally, foreign wordpress templates contain language pack files. , you can check whether there are files with .po or .pot in the lang or language folder. If there are files with .po or .pot in the template, we can use Poedit software to directly open them for translation. Copy the en_US.po file and paste it into the same folder and name it zh_CN.po, then open it directly with Poedit software for translation.
After the translation is completed, click "CTRL+S" to save, and a zh_CN.mo file will be formed in this folder. This file can be recognized by wordpress. language pack. If the WordPress system has a Chinese language pack installed, WordPress will call the zh_CN.mo file in this folder. This completes the Chineseization work of wordpress.
Related recommendations: "WordPress Tutorial"
2. The language file does not exist in the template
If the language file does not exist in the template, then We need to use Poedit software to automatically generate po files. The specific steps are as follows:
Step 1: Open the Poedit file, click "File"->"New Message Catalog Document", and a dialog box will pop up.
Step 2: Enter the text information in the pop-up dialog box:
Some tutorials indicate that some parts do not need to be written, but It is still recommended that everyone write it down to make it appear more perfect. The "source code character set" and "character set" should be related to the encoding method of WordPress you use, which is usually UTF-8.
Next, find the storage path on the disk of the theme you want to Chineseize, hold down "Ctrl+F4" to select the entire path, and copy it.
Paste the copied template path to the basic path, then click the button at the red box "1" below it, and paste the copied link in the lower box;
Then follow the above method and enter "__" and "_e" in the following positions.
Then click "OK", find the path to save on the disk and the name of the file in the pop-up dialog box, and click Save.
#If such a dialog box appears after the saving is completed, it means that the language pack of the WordPress theme you need to Chineseize has been generated.
Click OK, you can see the graphical interface shown in 1 under method 2, and then follow that method to translate and save step by step to complete the Chineseization of wordpress.
The translation of the wordpress language pack has been completed so far. If you still find that the display is still in English when you log in to the backend or check the frontend, please do not panic. This requires you to use Dreamweaver to open the functions.php file in the template, and add the following code before the "?>" at the end of the file:
function theme_init() { load_theme_textdomain($domain, $path); } add_action (‘init’, ’theme_init’);
where $domain: I think it is a unique identifier in translation, for example "StyleShop" in this case. __( 'Newer Comments →', 'StyleShop' ); However, some people understand it as the theme path name and do not comment on it.
$path: This is the path to the translation language package in the template, which is usually saved in the language or lang folder in the template.
For example, in the Styleshop template, load_theme_textdomain() is written like this.
load_theme_textdomain( 'StyleShop', $template_directory . '/lang' ); where $template_directory is the path of the template.
If the front or backend of the website still does not display in Chinese, please check the wp-config.php file in the root directory of the website, find the "define ('WPLANG', '')" position, and change Rewrite it as "define ('WPLANG', 'zh_CN');", then the website will be displayed in your Chinese language.
If you find that some places are still not perfect when appreciating your Chinese works, the only reason is that the Poedit software did not find it, or the part that needs to be translated does not use "__" or "_e" " function to standardize. Then you can use Dreamweaver software to find the parts that need to be Chineseized in the files in the site directory. Then use the function "__" or "_e" to specify or modify it directly.
The above is the detailed content of How to Chineseize WordPress theme. For more information, please follow other related articles on the PHP Chinese website!

wordpress后台乱码的解决办法:1、在wordpress的“wp-admin”文件夹下找到“admin.header.php”文件;2、将“charset”属性值设置为“UTF-8”格式即可恢复正常。

wordpress标签错误的解决办法:1、找到并打开wordpress的“wp-includes”目录下的“class-wp.php”文件;2、修改内容为“$pathinfo = isset( $_SERVER['PATH_INFO'] )?mb_convert_encoding($_SERVER['PATH_INFO'],'utf-8','GBK') : '';”即可。

你下载的WordPress主题提供的keywords和description这两个meta标签一般都做得很差,或者根本就不提供,这样不利于SEO。本文将指导你如何给主页、分类、页面以及文章页添加单独的Description 和 Keywords。

wordpress乱码的解决办法:1、修改“wp-config.php”文件里的“define(’DB_CHARSET’, ‘utf8′);”为“define(’DB_CHARSET’, ”);”;2、把新数据库的编码设置成“latin1_swedish_ci”;3、以uft8的格式导入备份的数据库文件即可。

wordpress进不去的解决办法:1、把地址栏“wp-login.php”后面的参数删掉,然后重新输入密码登录;2、登录FTP,下载“pluggable.php”文件,然后找到“ADMIN_COOKIE_PATH”并将它替换为“SITECOOKIEPATH”即可。

wordpress不是saas。SaaS是一种软件销售模式,它主要针对云端应用软件,而WordPress是一款CMS系统,它主要针对网站构建和管理。虽然WordPress可以作为SaaS提供服务,但它本质上不是一种SaaS应用。

本次PHP中文网整合了相关的视频教程,中文手册,以及相关的精选文章安利给大家,统统免费!!!通过我们分享的视频,可随时随地免费观看教程视频,也不需要迅雷或者百度网盘下载了。

wordpress是2003年发布的;Matt于2003年5月27日宣布推出第一版WordPress,受到了社区的欢迎,它基于b2 Cafelog并有显著改进;WordPress的第一个版本包括全新的管理界面、模板、XHTML 1.1兼容模板、内容编辑器。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
