apply_filters( 'wpml_current_language', mixed $empty_value )
- ประเภท
- filter
- หมวดหมู่
- ข้อมูลภาษาทั่วทั้งไซต์
- เวอร์ชันของ WPML
- 3.2
คำอธิบาย
ส่งคืนภาษาปัจจุบัน
อาร์กิวเมนต์
- $empty_value
- (mixed) (จำเป็น) โดยปกติแล้วนี่คือค่าที่ฟิลเตอร์จะทำการปรับเปลี่ยน เราไม่ได้ทำการกรองสิ่งใดที่นี่ ดังนั้นให้ตั้งค่านี้เป็น NULL ทั้งนี้เพื่อให้ฟังก์ชันฟิลเตอร์ได้รับรายการอาร์กิวเมนต์ทั้งหมด
ตัวอย่างการใช้งาน
ตัวอย่างพื้นฐาน
$my_current_lang = apply_filters( 'wpml_current_language', NULL );
การสร้าง shortcode เพื่อส่งคืนค่าภาษาปัจจุบัน
function get_language_shortcode() {
return apply_filters( 'wpml_current_language', null );
}
add_shortcode( 'language', 'get_language_shortcode' );
ฮุกที่เกี่ยวข้อง
wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages