[address_lookup_form_field]
The shortcode creates an address lookup field powered by the Google Maps API, which can be used within [search_form].
Product
Shortcode Attributes
There are a number of shortcode attributes available which you can use to customize the output.
General
- label – Field label displayed above the input.
- Options: Any text value.
- placeholder – Placeholder text for input fields.
- Default:
Enter Address. - Options: Any text value.
- Default:
- id – HTML ID attribute for the input field
- Default:
address-lookup. - Options: Any text value. Specify one only.
- Default:
- classes – Additional CSS classes for the field.
- Options: Any text value.
Location
- country_code – Restricts search to a specific country.
- Default:
au. - Options: Any country code value.
- Default:
- search_type – Limits search results to specific types
- Options:
geocode,address,establishment,regions,cities.- Example:
establishmenttype will return business results, whileaddresswill return geocoding results with precise address.
- Example:
- Options:
Data Handling
- data – Used to specify the address component to get from the lookup field.
- Default:
lat,lng. - Options:
lat,lng,post_code,country,state,city,suburb,street. Use commas,to separate.
- Default:
- data_format – Format for address components.
- Default:
short. - Options:
short,long. Specify one only.
- Default:
- autosubmit – Whether to auto-submit form on selection.
- Default:
on. - Options:
on,of. Specify one only.
- Default:
Example Usage
[search_form pageid=123]
[address_lookup_form_field label="Business Location" placeholder="Start typing your address..." search_type="cities"]
[/search_form]
Results
| Example: This example displays a search form (linked to page ID 123) with an address lookup field specifically designed to search for cities, labeled “Business Location” with a custom placeholder text “Start typing your address…”. |