[WordPress] 外掛分享: Open Currency Converter

前言介紹

  • 這款 WordPress 外掛「Open Currency Converter」是 2012-04-18 上架。
  • 目前有 1000 個安裝啟用數。
  • 上一次更新是 2025-04-29,距離現在已有 4 天。
  • 外掛最低要求 WordPress 4.6 以上版本才可以安裝。
  • 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
  • 有 18 人給過評分。
  • 論壇上目前有 1 個提問,問題解答率 0%

外掛協作開發者

dartiss | morehawes |

外掛標籤

cash | money | convert | currency | conversion |

內容簡介

🚀 如果您希望在文章或頁面的內文中即時轉換貨幣,那麼這款外掛程式就是您的理想選擇!它可免費下載、使用,並且不含廣告 - 如果您覺得自己需要支付費用,那麼您使用的方式可能不對!

假設您經營一個以英國為基礎的網站並且使用英鎊符號,但大多數訪客來自美國,您可能希望顯示相當於美元的金額。使用這個外掛程式,您可以輕鬆達成這個目標,而不必自己計算匯率,也不必在未來重複進行匯率轉換。

主要特點包括:

不需要自行更新匯率 - 資料從開放源碼 API 取得
支援超過 170 種貨幣
提供易於使用的簡碼,可直接嵌入您的文章和頁面
針對希望在主題中添加功能的使用者,提供 PHP 函數
結果可以被緩存,降低資源使用並提高響應
提供模板,讓您可以控制如何輸出結果
管理屏幕,讓您可以定義預設值並檢視當前匯率
還有更多!

圖示由非常有才華的 Janki Rathod 製作 ♥️

👉 請造訪 Github 頁面 以瞭解最新的程式碼開發、計劃中的增強功能和已知問題 👈

入門

🔑 取得您的應用程式金鑰

Open Currency Converter 取得資料的來源是 Open Exchange Rates 網站(此網站與此外掛程式和開發者無關)。為了防止匯率系統的過度使用並為希望支付金額的用戶提供優質功能,此網站需要指定一個應用程式金鑰。擁有高級方案對此外掛程式不會新增任何額外功能,也不是必要的條件。

取得應用程式金鑰的步驟如下:

在 Open Exchange Rates 網站上註冊 - 此連結將引導您前往免費選項,但此網站需要提供個人資訊。
您現在應該位於您的帳戶畫面。
點擊側邊選單中的「應用程式 ID」選項。
右側應列出一個應用程式 ID - 複製此 ID。
返回您的網站管理員,並選擇「設定」-> 「Open Currency」頁面。
將 App ID 粘貼到設定畫面頂部的相應欄位中。
點擊「儲存變更」按鈕。

使用簡碼

要在您的網站中添加簡碼,只需使用[convert]簡碼即可。例如...

[convert number=49.99 from="gbp" to="usd"]

這將會把 49.99 英鎊轉換為美元。

⚠️ 聲明

匯率數據是通過Open Source Exchange Rates項目免費提供的。其準確性和可用性不能保證,並且不提供任何保證。

🖥 選項畫面

啟用插件後,將出現兩個新的管理畫面。

Open Currency - 這出現在「設定」下,可讓您指定任何貨幣轉換的預設設定
Exchange Rates - 顯示在「工具」選單下,此選項將顯示當前匯率

原文外掛簡介

🚀 If you have a wish to convert currencies “on the fly” within the text of a post or page then this is the plugin for you! It’s free to download, free to use and advert free – if you think you have to pay for something you’re doing it wrong!
So, let’s say you run a UK based site and will refer to currencies in GBP. However, the majority of visitors are from the US, so you may have a wish to also show the dollar equivalent. Using this plugin you can do this without having to work out the conversion and then re-visit it in future to take into account conversion changes.
Key features include…

No need to update exchange rates yourself – data is fetched from an Open Source API
Over 170 currencies supported
An easy to use shortcode for embedding directly into your posts and pages
A PHP function for those people who wish to add features in their theme
Results can be cached, reducing resources and improving response
Template to allow you to control how results are output
Administration screen allowing you to define defaults and to view current exchange rates
And much, much more!

👉 Please visit the Github page for the latest code development, planned enhancements and known issues 👈
Getting Started
🔑 Getting Your App Key
Open Currency Converter gets its data from the Open Exchange Rates website (which is not associated with this plugin nor the developer). This site requires an App Key to be specified for it to work. This is to prevent over-use of the exchange system and to provide premium features for users who wish to pay for them. Having a premium plan does not add any extra features to this plugin and is not a requirement.
To get your App Key…

Sign up on the Open Exchange Rates site – this link will take you to the free option but the site does require personal information.
You should now be at your account screen.
Click on the “App IDs” option in the side menu.
An App ID should be listed on the right hand side – copy this ID.
Head back to the admin of your website and select the Settings -> Open Currency menu.
Paste the App ID into the equivalent field at the top of the settings screen.
Click the “Save Changes” button.

Using the Shortcode
To add to your site simply use the [convert] shortcode. For example…
[convert number="100" from="gbp" to="cad"]

This would convert 100 GBP to CAD.
⚠️ Disclaimer
The exchange rate data is provided for free via the Open Source Exchange Rates project. Its accuracy and availability are never guaranteed, and there’s no warranty provided.
🖥 The Options Screen
Once the plugin is activated two new administration screens will be present.

Open Currency – This appears under “Settings” and allows you to specify default settings for any currency conversion
Exchange Rates – Shown under the “Tools” menu, this displays the current exchange rates along with a list of all the valid exchange codes

Before using this plugin it is highly recommended that you review the Options screen and change any values, as appropriate. You will also need to sign up for and enter an App Key before conversions will work.
🗜 Using the Shortcode
The shortcode of ‘[convert]’ has the following parameters that you may specify…

number – The number that you wish to convert from one currency to another. This is required
from – The currency code that you wish to convert from (see the admin options for a list of valid codes). If you do not specify this value then the default from the options screen will be used
to – The currency code that you wish to convert to (see the admin options for a list of valid codes). If you do not specify this value then the default from the options screen will be used.
dp – How many decimal places the output should be. This should be numeric or the word “match”. The latter is the default and will mean that the output will match the number of decimal places that the number was.
template – See the later section, “Using Templates”, for further information
thousands_separator – The character that should be used to separate thousands in the output. This is a single character, such as a comma or period. If not specified then the default from the options screen will be used.

Example of use are…
[convert number=49.99 from="gbp" to="usd"]

This would convert 49.99 from UK pounds to US dollars and output the result to 2 decimal places.
[convert number=50 from="usd" to="gbp"]

This would convert 50 from US dollars to UK pounds and output the result without any decimal places.
If the conversion can’t be done then an appropriate error message will be output instead. If you wish to suppress these messages then you need to use a template (see the later section on this) – in this case no output will be generated in the case of an error.
You can specify the thousands separator either through the options screen or by using the thousands_separator parameter (default is a comma). This will be used to format the output of the conversion result:
[convert number=50 from="usd" to="gbp" thousands_separator="."]

🧩 Using Templates

The template option allows you to specify other information to be output along with the conversion result. None of the template will be output if any error occurs, including any error messages, allowing you to suppress any conversion text in the case of a problem.
The template text must include %result% where you wish the output to appear.
Here’s an example…
The retail price is $49.99[convert number=50 from=“use” to=“gap” template=" (approx.%result%) GBP”].

Normally, this would print a result such as…
The retail price is $49.99 (approx. 79.11 GBP).

However, if an error occurs then it will print as…
The retail price is $49.99.

You may also include the template between opening and closing shortcode tags. For example…
The retail price is $49.99[convert number=50 from=“use” to=“gap”] (approx. %result% GBP)[/convert].

Using the Function Call

If you wish to perform a currency conversion within your theme, rather than within a post or page, then you can use a PHP function call. The function name is get_conversion and will return the result back.

All of the shortcode parameters are valid, except for the template which isn’t required
The parameters are specified in any order and are separated with an ampersand
You should not add quotes around each parameter value, as you do with the shortcode

For example…

🌍 Global conversion variables

For the use of developers, 2 global variables have been added which, if assigned within your site code, will override the conversion codes.
The variables are global_convert_from and global_convert_to.
This is useful if, say, you have multiple versions of the site in different languages – you can then assign these global variables depending on which site is being viewed and all currency will be converted based upon these settings.
These will only override the options screen and not specific parameters specified with a shortcode or function call.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Open Currency Converter」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.0 | 1.2 | 1.0.1 | 1.1.1 | 1.3.1 | 1.4.7 | 1.4.8 | 1.4.9 | 1.5.0 | trunk |

延伸相關外掛(你可能也想知道)

  • WooCommerce Cash On Pickup 》在你的 WooCommerce 商店中接受「現場取貨付款」付款方式。, 功能:, , 可自定義說明文字列印在結帳及「感謝您」頁面上,並加入寄給客戶的電子郵件中, 如果客...。
  • Conekta Payment Gateway 》目前版本的功能包括:, , 使用 Conekta.js – 無需 PCI 認證問題(需要 SSL 憑證), 支援信用卡和借記卡付款, 支援現金付款, 可進行 Sandbox 測試, 自動...。
  • Rapyd Payment Extension for WooCommerce 》透過 Rapyd WooCommerce 外掛程式,您可以快速且簡單地新增付款選項,擴展現有市場或是進入新的國家。, 使用 Rapyd WooCommerce 外掛程式,讓您的客戶選擇他...。
  • Get Cash 》透過本外掛,在您的 WordPress 網站任何位置都可使用按鈕或 QR 碼接收來自 Cash App、Venmo、PayPal 等方式的款項、小費、捐款。, 欲了解更多本外掛詳情,請...。
  • Payment Cash Pickup 》此外掛可在您的 WooCommerce 商店中新增「Cash」付款系統。, , [WordPress Cash Pickup] (http://www.webcreates.eu/download/payment-cash-pickup.zip), , ...。
  • Spin Payment Gateway 》總結:這個 WordPress 外掛的目前版本功能包括統一的API Key整合、提煉結帳流程、自動訂單狀態管理和成功訂單的電子郵件通知。外掛依賴DigitalFemsa API和Dig...。
  • Bank Slip for Woocommerce 》需要管理支票和現金付款嗎?, 這個外掛可以為支票、現金或所有其他付款方式產生銀行存款單。, 只需在訂單中選擇所需的項目,並用批量操作將其匯出到銀行存款...。
  • Pay by Cash for Woocommerce 》總結:, 這個外掛將一個“現金支付”付款方式添加到 WooCommerce 上。它允許顧客選擇在交貨時現金支付。管理員可以配置顯示名稱並映射啟用的交付方式。, , 問題...。
  • WPDB Cache Money 》Cache Money會將所有資料庫查詢結果以序列化的方式儲存在檔案系統中,並使用常常被忽略的wp-content/db.php來擴展正常的$wpdb類別。當使用者進行會影響到資料...。

文章
Filter
Apply Filters
Mastodon