[WordPress] 外掛分享: Primo Vars

首頁外掛目錄 › Primo Vars
WordPress 外掛 Primo Vars 的封面圖片
全新外掛
安裝啟用
尚無評分
剛更新
最後更新
問題解決
WordPress 6.3+ PHP 7.4+ v1.0.0 上架:2026-08-29

內容簡介

Primo Vars 外掛讓您在 WordPress 網站中輕鬆管理聯絡資訊。透過簡單的設定,您可以在多個頁面上使用相同的電話號碼或電子郵件,並在需要時隨時更新,省去逐一修改的麻煩。

【主要功能】
• 定義變數一次,隨處使用短碼
• 支援電話、電子郵件、地址等多種格式
• 自訂標籤與多行文字顯示
• 提供開發者過濾器以自訂輸出
• 自動處理電話號碼格式與連結

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Primo Vars」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Contact details have a habit of appearing on a dozen pages. When the phone number or email changes, you get to find every one of them – a real pain!
Primo Vars fixes that. Define a value once on a single settings screen, give it a name, and use its shortcode wherever you need it. Change the value and every page follows.
Each variable has a type, and the type does the fiddly work for you:

Phone: renders a tappable tel: link, while displaying the number exactly as you typed it, brackets, spaces, country code and all.
Email: renders a mailto: link with the address obfuscated against scrapers.
Link: renders an anchor, with an optional custom label.
Address: a multi-line field that keeps your line breaks.
Multi-line text: the same, for opening hours, a disclaimer, anything that runs to more than one line.
Text: renders plain text, for anything else.

Usage
[primo_var key="phone"]
[primo_var key="email"]
[primo_var key="facebook" text="Follow us"]
[primo_var key="phone" raw="1"]

raw="1" returns the plain value with no link, for when you are building your own markup around it.

In a theme template:

In the block editor
Insert the Primo Var block, pick a variable from the dropdown, and it
renders exactly what the shortcode would. Use the shortcode when you want a
value inline in a sentence, and the block when it stands on its own.
Starter variables
A fresh install creates seven empty variables to fill in: phone, email,
address, facebook, instagram, linkedin and youtube. Delete the ones you do not
want, or add your own. A YouTube channel is just a Link, the same as any other
social profile.
For developers
Filter primo_vars_output to change what any variable renders, from the
shortcode, the block and primo_vars_get() alike. It fires for a variable
that is defined but left empty, which is what the example below relies on;
it does not fire for a key that is not defined at all, since all three entry
points return an empty string before reaching this filter in that case.
add_filter( 'primo_vars_output', function ( $html, $var, $atts ) {
if ( '' === $html && 'phone' === $var['type'] ) {
return 'Call the office';
}
return $html;
}, 10, 3 );

The HTML handed to the filter is already escaped. Anything your callback adds
is yours to escape.
Phone numbers with extra text
Real phone numbers are messy. +61 491 570 156 Option 2 and (08) 8123 1234 both display exactly as typed, and both produce a correct dial link. The trailing “Option 2” is not dialled.
Where the number cannot be worked out automatically, no link is shown rather than a wrong one. That covers vanity numbers like 1300 PRIMO, and two numbers written in one field such as (08) 8123 1234 (0412 345 678). Fill in the optional Dial as field on that row and it will link exactly as you specify.

延伸相關外掛

文章
Filter
Mastodon