If a client has multiple locations with different phone numbers, hardcoding a single number in the header doesn’t work. Using Advanced Custom Fields alongside GenerateBlocks dynamic data, you can make the header phone number change automatically based on which location page a visitor is viewing.
Set Up the ACF Phone Number Field
In Advanced Custom Fields, create or open a field group assigned to pages. Add a text field for the phone number and set a default value. This default is the general business number — it will appear on any page that doesn’t have a location-specific number assigned.
One thing to note: ACF default values only apply to new posts. On existing pages, the field will be empty until you manually enter a value. Go through each existing page and confirm the phone number field is populated — either with the default number or the location-specific one.
Assign Phone Numbers to Each Location Page
On each location page, open the page fields and enter the phone number for that office. Pages that don’t represent a specific location should carry the default business number so the header always displays something.
Update the Header Button with Dynamic Data
Go to the site header and open the button block that currently displays the hardcoded phone number. Delete the phone number text and replace it with a dynamic data tag using post meta. Select the phone number field created in ACF — this is the field key from the page fields group.
For the button link, use the tel: format with GenerateBlocks dynamic data syntax:
tel:{{post_meta key="phone_number"}}
The exact key name matches whatever was set when creating the ACF field.
Save the header. If the number doesn’t appear immediately on the front end, open the page with the default value and resave it. ACF sometimes needs a resave on existing posts before it recognizes a newly assigned default.
How It Works on the Front End
Once the dynamic data is in place, the header button pulls its number from the phone number field on whatever page is being viewed. Pages without a location-specific number show the default. Location pages show their assigned number automatically — no additional configuration needed per page beyond entering the number in the ACF field.
Other Uses for This Approach
This same method works for any piece of information that needs to vary by page — addresses, email addresses, hours of operation, or any other location-specific detail. The combination of an ACF field with a default value and GenerateBlocks dynamic data keeps the header global while still allowing per-page customization where needed.