WooCommerce在WordPress的定義國家類,如下所示(編輯來回簡潔)獲得國名
class WC_Countries {
public $countries;
public function __construct() {
global $woocommerce, $states;
$this->countries = apply_filters('woocommerce_countries', array(
'AF' => __('Afghanistan', 'woocommerce'),
'AX' => __('Åland Islands', 'woocommerce'),
'AL' => __('Albania', 'woocommerce'),
'DZ' => __('Algeria', 'woocommerce'),
));
}
}
當訂單被放置,所述國家代碼被寫入的Wordpress wp_postmeta表,並且可以可以隨時隨地提取訂單ID可以使用get_post_meta()
函數訪問:
get_post_meta($order->id, '_shipping_country', true),
的問題是,作爲WEARE簡單地從數據庫中拉兩個人物,怎麼能送貨的國家代碼(例如AF)被翻譯成國家名字在中給出國家班?
以及如何獲得特定語言的國家名稱?例如sk_SK? – 2017-06-01 09:45:04