wordpresswpml

How do i know the language of post/page in wordpress using wpml?


I am using wpml by using this code i can get the id of post/page

$id = icl_object_id($course_id, 'page', false, ICL_LANGUAGE_CODE);

i want to know that how can i get the language type of post/page i have tried WP_query but it was futile


Solution

  • I have found the solution ,

    $post_language_information = wpml_get_language_information(get_the_ID());
    echo <pre>;
    print_r($post_language_information );
    echo </pre>;
    

    output

    Array
    (
        [language_code] => zh-hant
        [locale] => zh_TW
        [text_direction] => 
        [display_name] => 繁體中文
        [native_name] => 繁體中文
        [different_language] => 
    )