| 开发者 | zurtri |
|---|---|
| 更新时间 | 2026年8月31日 05:15 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
tel: link, while displaying the number exactly as you typed it, brackets, spaces, country code and all.mailto: link with the address obfuscated against scrapers.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.
/wp-content/plugins/ and activate it.Nothing renders. Visitors never see a placeholder or an error message.
A link needs its scheme, so use https://facebook.com/you rather than facebook.com/you. The plugin tells you which variable it refused and leaves the old value in place rather than saving something that would not work.
Yes. Widget areas have been block-based since WordPress 5.8, so add the Primo
Var block, or a Shortcode block holding [primo_var], to any widget area or
site editor template.
Navigation menu labels are the exception: WordPress does not run shortcodes
there, and this plugin deliberately does not add a filter to make it, because
broad do_shortcode() filters widen the injection surface for everyone.
No. No external requests, no tracking.