Posted By

zartgesotten on 12/08/09


Tagged

plugin wordpress WPML


Versions (?)

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


 / Published in: PHP
 

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

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.

  1. // Languages links to display in the header
  2. //
  3. function wpml_languages_list_notext($skip_missing=0, $div_id = "langselector"){
  4. if(function_exists('icl_get_languages')){
  5. $languages = icl_get_languages('skip_missing='.intval($skip_missing));
  6. if(!empty($languages)){
  7. echo '<div id="'.$div_id.'"><ul>';
  8. foreach($languages as $l){
  9. echo '<li>';
  10. if(!$l['active']) echo '<a href="'.$l['url'].'">';
  11. echo '<img src="'.$l['country_flag_url'].'" alt="'.$l['language_code'].'" />';
  12. if(!$l['active']) echo '</a>';
  13. //if(!$l['active']) echo '<a href="'.$l['url'].'">';
  14. // echo $l['native_name'];
  15. //if(!$l['active']) echo ' ('.$l['translated_name'].')';
  16. //if(!$l['active']) echo '</a>';
  17. echo '</li>';
  18. }
  19. echo '</ul></div>';
  20. }
  21. }
  22. }

Report this snippet  

You need to login to post a comment.