List of countries and their states in wordpress
Where is the list of countries and states located in wordpress? When you select United States on a checkout form the "state" field immediately changes to contain the list of states. I would like to imitate this behavior for other countries. For example when selecting Honduras, you will get the list of states of that country.
Is there an XML file, php file or Database table where Wordpress access this information? that way it could be editable to be able to add the states without having to add a plugin or write extra code.
I know you can access the list from the code with WC()->countries->get_states
how ever where is it obtaining it from?
There is a folder called i18n
and in that folder there is another folder called states
, which contains a list of files. Add your file there as HN.php
with a list of the states you want shown eg:
<?php
/**
* Honduras
*
* @author WooThemes
* @category i18n
* @package WooCommerce/i18n
* @version 2.0.0
*/
global $states;
$states['HN'] = array(
'AA' => __( 'Some state', 'woocommerce' ),
);
链接地址: http://www.djcxy.com/p/57540.html
上一篇: html多语言显示语言名称
下一篇: 在wordpress中列出国家及其国家