acfcs_get_states()

Description

This function returns an array containing all states with 'country code + state code' as key and the country name as label.

Usage

  1. $stages = acfcs_get_states( 'NL' );

Returns

  1. array(
  2.   'NL-DR' => 'Drenthe',
  3.   'NL-FL' => 'Flevoland',
  4.   'NL-FR' => 'Friesland',
  5.   'NL-GE' => '"Gelderland',
  6.   'NL-GR' => 'Groningen',
  7.   'NL-LI' => 'Limburg',
  8.   'NL-NB' => '"Noord-Brabant',
  9.   'NL-NH' => '"Noord-Holland',
  10.   'NL-OV' => '"Overijssel',
  11.   'NL-UT' => 'Utrecht',
  12.   'NL-ZE' => 'Zeeland',
  13.   'NL-ZH' => '"Zuid-Holland',
  14. )

This function makes use of a transient, called 'acfcs_states_{$country_code}'.

Arguments

  • (string) - $country_code (required)
    Country code (exactly 2 characters).
  • (bool) - $show_first (optional)
    Whether to include an empty option (used for dropdowns) | default false.
  • (bool) - $show_labels (optional)
    Whether to show a text in the first option (used for dropdowns) | default false.

Defined in

- line 67

Used in