dimanche 8 novembre 2015

How to change language flag in WPML language switcher only for active language?

I'm trying to set b&w flag for active language in WPML language switcher within Wordpress, but can not do it just for the active language. Is it even possible, to set for active language diffrent flag? (If I had 2 languages, I will be using 4 flags (2b&w for active language and 2rgb for inactive at a time)) The function I'm editing is as follows:

function widget_list() {
    global $sitepress;

    $active_languages = icl_get_languages();
    if ( empty( $active_languages ) ) {
        return;
    } ?>

    <div id="lang_sel_list"<?php if ( empty( $this->settings[ 'icl_lang_sel_type' ] ) || $this->settings[ 'icl_lang_sel_type' ] == 'dropdown' ) {
        echo ' style="display:none;"';
    } ?> class="lang_sel_list_<?php echo $this->settings[ 'icl_lang_sel_orientation' ] ?>">
        <ul>
            <?php
            $li_items = '';
            foreach ( $active_languages as $lang ) {
                $language_selected = ' class="lang_sel_';
                $language_selected .= $lang[ 'language_code' ] === $sitepress->get_current_language() ? 'sel"' : 'other"';
                $li_items .= $sitepress->render_ls_li_item( $lang, false, true, $language_selected );
            }
            echo $li_items;
            ?>
        </ul>
    </div>
<?php
}

Details to WPML custom language switchers are here, but none of them covers my case> http://ift.tt/1M51duy

Thanks for any suggestions in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire