You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Added — {{phone}} base tag
New first-class {{phone}} base tag (cross-source like {{email}}/{{text}}, in includes/tags/phone-tags.php) that outputs a stored phone number, by default wrapped in a tel: link. The number is read from a meta/option field via the standard field-read path, so it works in every source: src:site → wp_options / ACF-options; src:current/unset → post/term meta; src:ref / srcTermIn → traversed-entity meta (list mode). Key-required in every source (no use enum).
tel: href is rebuilt from the stored value, preserving the author's separators. Unlike {{email}} (whose href is the address verbatim), the tel: href is normalized into a canonical dial value. Hyphens appear in the href only where the author wrote a separator — (987) 654-3210 → tel:+1-987-654-3210, but bare 9876543210 → tel:+19876543210 (no fabricated grouping). The display text stays the stored value verbatim; only the href is reformatted. (Display-side formatting is a planned follow-up.)
Country code resolves 2-tier: an in-field international prefix (+… or 00…) wins; otherwise the global Settings → Tag Extensions → Phone → "Default country code" (digits only, empty default) is prepended. With no country code and no in-field prefix, a national tel: link (no +) is emitted — fine for single-country sites. A leading national trunk 0 is stripped when a country code is applied (e.g. UK 07911… → +44-7911…). The country-code setting field shows worked-example placeholder text and links a country-code reference.
Separated leading country code is auto-deduplicated. When a +-less number carries the global country code as its own author-separated first group (1-800-555-1212, 1 (800) 555-1212, 1.800.555.1212 with country code 1), the number already contains the code, so it is treated as international and the global code is not prepended again — → +1-800-555-1212, never a doubled +1-1-800…. The author's separator is the disambiguating signal; this never fires on a flat bare-digit string.
Optional unseparated leading-country-code strip (global Phone → "Strip unseparated leading digit(s) matching the default country code", default OFF) covers the harder, separator-less case the auto-dedupe cannot — a code run together with the national number and no + (e.g. 18005551212 with country code 1). With no separator there is no way to tell a real code prefix from a national number that begins with the same digits, so this is opt-in and warned. Matches the configured global country code only.
Default-ON tel: wrap toggled by noLink (inverted bare key — absent = wrap, present = plain text), and visibility-gated off a/button/img/picture, mirroring {{email}}. Cross-source list mode (limit/sep) wraps each valid number individually. A fallback phone number fires only when no valid number resolves. Unparseable numbers (assembled digit count outside 7–15) are skipped this release.
Media-block safety backstop (also applied to {{email}}). The native visibility gate cannot hide these tags on the GB media block — that block's tagName defaults to "" and never serializes (its enum holds only img), so the value-compare leaves the tag offered, and GB then injects the output into the <img src>, corrupting it. Both callbacks now detect a generateblocks/media host block and emit nothing, so the default-on link wrap can never break an image. Editor-picker UX (hiding the tag in the selector there) is tracked in #35; the GB constraint is documented in docs/gb-constraints.md.