I’ve noticed an emerging pattern in web-based forms is to put the country field before city/state. This is contrary to how we would normally fill out an address on paper, but it allows us to have dynamic form labels and dropdowns.
Drupal: International Address Field Standard
As mentioned, this module uses the xNAL (Extensible Name and Address Language) vocabulary for describing address information. The terms used to designate various parts of an address may not be immediately recognizable, so this quick glossary equates the address parts in xNAL to their equivalent U.S. address terms (with some being self-evident):
- country => Country (always required, 2 character ISO code)
- name_line => Full name (default name entry)
- first_name => First name
- last_name => Last name
- organisation_name => Company
- administrative_area => State / Province / Region (ISO code when available)
- sub_administrative_area => County / District (unused)
- locality => City / Town
- dependent_locality => Dependent locality (unused)
- postal_code => Postal code / ZIP Code
- thoroughfare => Street address
- premise => Apartment, Suite, Box number, etc.
- sub_premise => Sub premise (unused)
WordPress Settings API Settings generator
WordPress Plugin: Custom Settings Page
Sometimes you may want to create a new custom settings page for your plugin, versus inserting your options in an existing page.
You’ll use
<a href="https://developer.wordpress.org/reference/functions/add_options_page/">add_options_page</a>
to do this.