WordPress.org

Ready to get started?Download WordPress

Forums

WMPL - Language switcher - Flags only (1 post)

  1. wzag
    Member
    Posted 1 year ago #

    Hello WordPress Team,

    I'm looking for a solution on how to integrate a language switcher, only with flags, into my website.
    I work with wmpl and inserted the proposed code in to function.php (see below) of my Merchant theme. This didn't lead to desired results. The fact is that I have several themes on the website: http://www.stopp-schnarchen.de. Can anybody advise how to go on? Your reply is very appreciates.

    Best regards,

    Anastasia

    Code:

    function language_selector_flags(){
        $languages = icl_get_languages('skip_missing=0&orderby=code');
        if(!empty($languages)){
            foreach($languages as $l){
                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>';
            }
        }
    }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

Topic Closed

This topic has been closed to new replies.

About this Topic