內容簡介
這個外掛需要 Polylang。
該外掛提供了一種方法,在文章頁面上包含當前語言中沒有翻譯的文章。
使用方法
多語言 Polylang 提供了兩個公共函數:
函數 MultilingualPolylang::get_query() 返回一個帶有文章的 WP_Query 物件,包括所有語言的文章,但除非有翻譯的文章,否則只會包括當前語言中的文章。
函數 MultilingualPolylang::get_permalink() 可以用作 get_permalink() 的替代品。這將替換文章網址中的語言,以便以與界面其餘部分語言不同的語言查看文章。
在 GitHub 上關注此項目
開發
該外掛使用 wp-cli 和 PHPUnit 进行测试。
从 GitHub 下载源代码
$ git clone [email protected]:aptivate/multilingual-polylang.git
安装 wp-cli
如果尚未安装,请安装 wp-cli
安装 PHPUnit
如果尚未安装,请安装 PHPUnit
安装测试 WordPress 环境
$ cd multilingual-polylang
$ bash bin/install-wp-tests.sh test_db_name db_user'db_password' db_host version
其中:
test_db_name 是您的临时测试 WordPress 数据库的名称
db_user 是数据库用户名
db_password 是密码
db_host 是数据库主机(例如 localhost)
version 是 WordPress 版本(例如 4.7.5 或最新版本)
运行测试
从插件目录中:
$ phpunit
外掛標籤
開發者團隊
原文外掛簡介
This plugin, which requires polylang
provides the means to include posts that have no translation in the current
language on pages of posts.
Usage
Multilingual Polylang provides two public functions:
The function MultilingualPolylang::get_query() returns a WP_Query object with posts from
all languages but where there is a translated post, only the post in the current
language will be included
The function MultilingualPolylang::get_permalink() can be used as a drop-in replacement to
get_permalink(). This will replace the language in a post URL so that a post
can be viewed in a language different to that of the rest of the interface.
Follow this project on GitHub
Development
This plugin uses wp-cli and PHPUnit for testing.
Download the source code from GitHub
$ git clone [email protected]:aptivate/multilingual-polylang.git
Install wp-cli
If not already present, install wp-cli
Install PHPUnit
If not already present, install PHPUnit
Install the test WordPress environment
$ cd multilingual-polylang
$ bash bin/install-wp-tests.sh test_db_name db_user 'db_password' db_host version
where:
test_db_name is the name of your temporary test WordPress database
db_user is the database user name
db_password is the password
db_host is the database host (eg localhost)
version is the version of WordPress (eg 4.7.5 or latest)
Run the tests
From the plugin directory:
$ phpunit
