أنا أستخدم WordPress MultiLanguage Plugin وأريد أن أعرف ما هي لغة عنصر معين أو صفحة أو منشور معين.
لدي id
ولكني أريد الحصول على اللغة.
للحصول على لغة منشور أو صفحة محددة ، يمكنك استخدام wpml_get_language_information()
. هذا إرجاع صفيف مع الفهارس التالية:
مثال
$language_information = wpml_get_language_information($post_id);
$locale = $language_information['locale'];
لقد وجدت هذه الوظيفة عبر andreas.n على منتديات WPML .
من موقع WPML:
http://wpml.org/documentation/support/wpml-coding-api/
Language constants
WPML defines the following constants which can be used in the theme:
Constant Description Example
ICL_LANGUAGE_CODE Code for the current language fr
ICL_LANGUAGE_NAME Name of current language, in the current language Français
ICL_LANGUAGE_NAME_EN Name of the current language name in English French