Title: Units
Author: Kyle Phillips
Published: <strong>2015 年 2 月 24 日</strong>
Last modified: 2015 年 8 月 21 日

---

搜索插件

![](https://ps.w.org/units/assets/banner-772x250.png?rev=1098692)

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/units/assets/icon-128x128.png?rev=1098692)

# Units

 作者：[Kyle Phillips](https://profiles.wordpress.org/kylephillips/)

[下载](https://downloads.wordpress.org/plugin/units.1.0.2.zip)

 * [详情](https://cn.wordpress.org/plugins/units/#description)
 * [评价](https://cn.wordpress.org/plugins/units/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/units/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/units/#developers)

 [支持](https://wordpress.org/support/plugin/units/)

## 描述

**Why Units?**

Units provides your users with an intuitive way to choose and display their preferred
unit of measurement. The user’s preferred unit of measurement is saved via session,
cookie, or none – configurable under the plugin settings.

Any number of primary/alternate units can be added, along with their conversion 
formulas.

Visit [unitswitcher.com](http://unitswitcher.com) for more detailed information.

**Using Units**

Add primary units under Settings > Units. Alternate units may be added by providing
their name and conversion formula. Multiple alternate units may be added for each
primary unit.

Use the function `unit_switcher($value, $primaryunit, $round)` in your template 
to display the switcher. Pass the stored value as the first parameter and primary
unit of measurement as the second value.

To display a single switcher, the shortcode [unit_switcher] is available for use.
The shortcode requires two parameters: `unit` (the primary unit being converted)
and `value` (the stored value).

For more information visit [unitswitcher.com](http://unitswitcher.com).

**Important: Unit Switcher requires WordPress version 3.8 or higher, and PHP version
5.3.2 or higher.**

### More Information

#### Using the Template Function

**unit_switcher($variable, $primaryunit, $round);**

Parameters:
 * $variable – The stored value (integer or float) * $primaryunit – 
The primary unit (the stored value should be stored in this unit) * $round – Number
of digits to round to (default is 2)

Visit [unitswitcher.com](http://unitswitcher.com) for more detailed information.

## 屏幕截图

 * [[
 * Display a dropdown method for users to toggle between units of measurement.
 * [[
 * Optionally save the user’s preference via the session or cookie.
 * [[
 * Add as many units/alternate units as needed.

## 安装

 1. Upload unit-switcher to the wp-content/plugins/ directory
 2. Activate the plugin through the Plugins menu in WordPress
 3. Visit the plugin settings to add units of measurement
 4. Use the unit_switcher() template function or [unit_switcher] shortcode to display
    the switcher

## 常见问题

  Is this plugin WPML compatible?

The plugin is not yet WPML compatible.

  How do I add a unit of measurement?

Visit Settings > Unit Switcher. A primary unit of measurement is required, along
with at least one alternate unit. Substitute the primary unit with `X` in the formula
to equal the alternate formula. So, to set an alternate unit of `inches` for a primary
unit of `feet`, the formula should be set to `X*12`.

## 评价

此插件暂无评价。

## 贡献者及开发者

「Units」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Kyle Phillips ](https://profiles.wordpress.org/kylephillips/)

[帮助将「Units」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/units)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/units/)，查看[SVN仓库](https://plugins.svn.wordpress.org/units/)，
或通过[RSS](https://plugins.trac.wordpress.org/log/units/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/units/)。

## 更新日志

#### 1.0.2

 * Bug fix – conflict with Bootstrap Javascript libary resolved.

#### 1.0.1

 * Page caching conflicts resolved. If using a page cache plugin, visit Settings
   > Unit Switcher to enable the fix.
 * Minor bug fixes in options saving

#### 1.0

 * Initial release

## 额外信息

 *  版本 **1.0.2**
 *  最后更新：**11 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 3.8 或更高版本 **
 *  已测试的最高版本为 **4.3.34**
 *  语言
 * [English (US)](https://wordpress.org/plugins/units/)
 * 标签
 * [localization](https://cn.wordpress.org/plugins/tags/localization/)[measurements](https://cn.wordpress.org/plugins/tags/measurements/)
   [units](https://cn.wordpress.org/plugins/tags/units/)
 *  [高级视图](https://cn.wordpress.org/plugins/units/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  1 条 5 星评价     ](https://wordpress.org/support/plugin/units/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/units/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/units/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/units/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/units/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/units/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/units/reviews/)

## 贡献者

 *   [ Kyle Phillips ](https://profiles.wordpress.org/kylephillips/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/units/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://unitswitcher.com/)