Return to Snippet

Revision: 21255
at December 20, 2009 05:25 by zartgesotten


Updated Code
// Languages links to display in the header
//
function wpml_languages_list_notext($skip_missing=0, $div_id = "langselector"){
    if(function_exists('icl_get_languages')){
        $languages = icl_get_languages('skip_missing='.intval($skip_missing));
        if(!empty($languages)){
            echo '<div id="'.$div_id.'"><ul>';
            foreach($languages as $l){
                echo '<li>';
                if(!$l['active']) echo '<a href="'.$l['url'].'">';
                echo '<img src="'.$l['country_flag_url'].'" alt="'.$l['language_code'].'" />';
                if(!$l['active']) echo '</a>';
                //if(!$l['active']) echo '<a href="'.$l['url'].'">';
               // echo $l['native_name'];
                //if(!$l['active']) echo ' ('.$l['translated_name'].')';
                //if(!$l['active']) echo '</a>';
                echo '</li>';
            }
            echo '</ul></div>';
        }
    }
}

Revision: 21254
at December 8, 2009 05:18 by zartgesotten


Initial Code
function languages_list_footer(){
    $languages = icl_get_languages('skip_missing=0');
    if(!empty($languages)){
        echo '<div id="footer_language_list"><ul>';
        foreach($languages as $l){
            echo '<li>';
            if($l['country_flag_url']){
                if(!$l['active']) echo '<a href="'.$l['url'].'">';
                echo '<img src="'.$l['country_flag_url'].'" height="12" alt="'.$l['language_code'].'" width="18" />';
                if(!$l['active']) echo '</a>';
            }
            //if(!$l['active']) echo '<a href="'.$l['url'].'">';
            //echo icl_disp_language($l['native_name'], $l['translated_name']);
            //if(!$l['active']) echo '</a>';
            echo '</li>';
        }
        echo '</ul></div>';
    }
}

Initial URL
http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/#language_switcher

Initial Description
Of course the Plugin from wpml.org has to be installed, the file "wpml-integration.php" from docs/theme-integration has to be copied into your theme-directory and the call include "wpml-integration.php"; has to be copied to your functions.php. After that, you can simply place <?php> somewhere in your theme.

Initial Title
WPML.org Insert Language Selector with ONLY Flags (horizontal)

Initial Tags
plugin, wordpress

Initial Language
PHP