function kt_get_wpml() { //Check function icl_get_languages exist if (kt_is_wpml()) { $languages = icl_get_languages('skip_missing=0&orderby=code'); if (!empty($languages)) { //Find language actived foreach ($languages as $lang_k => $lang) { if ($lang['active']) { $active_lang = $lang; } } } $html = '<div class="language"> <div class="dropdown"> <a class="current-open" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#"> <img alt="email" src="' . esc_url($active_lang['country_flag_url']) . '" /> <span>' . $active_lang["translated_name"] . '</span> </a>'; $html .= '<ul class="dropdown-menu" role="menu">'; foreach ($languages as $lang) { printf('<li><a href="%4$s"><img src="%1$s" alt="%2$s"><span>%3$s</span></a></li>', esc_url($lang['country_flag_url']), $lang["language_code"], $lang["translated_name"], $lang['url']); } $html .= '</ul> </div> </div>'; return $html; } }
function kt_show_vertical_menu_option_7() { global $kt_enable_vertical_menu; $kt_click_open_vertical_menu = kt_option('kt_click_open_vertical_menu', 'disable'); $kt_vertical_item_visible = kt_option('kt_vertical_item_visible', 11); if ($kt_enable_vertical_menu == 'enable') { ?> <div class="nav-top-menu enable_vm"> <div class="container"> <div class="row"> <div class="col-sm-3" id="box-vertical-megamenus"> <div data-items="<?php echo esc_attr($kt_vertical_item_visible); ?> " class="box-vertical-megamenus <?php if ($kt_click_open_vertical_menu == "enable") { echo esc_attr('hiden_content'); } ?> "> <h4 class="title"> <span class="btn-open-mobile home-page"><i class="fa fa-bars"></i></span> <span class="title-menu"><?php _e('Categories', 'kutetheme'); ?> </span> </h4> <div class="vertical-menu-content is-home"> <?php kt_setting_vertical_menu(); ?> <div class="all-category"><span class="open-cate"><?php esc_html_e('All Categories', 'kutetheme'); ?> </span></div> </div> </div> </div> <?php if (kt_is_wpml()) { ?> <div class="col-sm-5 col-md-6 col-lg-7 formsearch-option4"> <?php kt_search_form(); ?> </div> <div class="col-sm-4 col-md-3 col-lg-2 group-link-main-menu"> <?php echo kt_get_wpml(); ?> </div> <?php } else { ?> <div class="col-sm-5 col-md-9 col-lg-9 formsearch-option4"> <?php kt_search_form(); ?> </div> <?php } ?> </div> </div> </div> <?php } else { ?> <div class="nav-top-menu disable_vm"> <div class="container"> <div class="row"> <?php if (kt_is_wpml()) { ?> <div class="col-sm-8 col-md-9 col-lg-9 formsearch-option4"> <?php kt_search_form(); ?> </div> <div class="col-sm-4 col-md-3 col-lg-3 group-link-main-menu"> <?php echo kt_get_wpml(); ?> </div> <?php } else { ?> <div class="col-sm-12 formsearch-option4"> <?php kt_search_form(); ?> </div> <?php } ?> </div> </div> </div> <?php } }
/** * Custom wpml * */ function kt_custom_wpml($before = '', $after = '', $title = '', $icon = '<i class="icon_ribbon_alt"></i>') { if (kt_is_wpml()) { $output = $language_html = ''; if ($title) { $output .= '<a href="#">' . $icon . $title . '</a>'; } $languages = icl_get_languages(); if (!empty($languages)) { foreach ($languages as $l) { $active = $l['active'] ? 'current' : ''; $language_html .= '<li class="' . $active . '">'; $language_html .= '<a href="' . esc_url($l['url']) . '">'; if ($l['country_flag_url']) { $language_html .= '<img src="' . esc_url($l['country_flag_url']) . '" height="12" alt="' . esc_attr($l['language_code']) . '" width="18" />'; } $language_html .= "<span>" . $l['native_name'] . "</span>"; $language_html .= '</a>'; $language_html .= '</li>'; } if ($language_html != '') { $language_html = '<ul class="list-lang">' . $language_html . '</ul>'; } $output .= $language_html; } echo $before . $output . $after; } }
/** * Function selector lan * * @since boutique 1.0 * @author AngelsIT */ function kt_wpml() { ?> <?php if (kt_is_wpml()) { global $sitepress; $active_languages = $sitepress->get_ls_languages(); ?> <div class="select-language"> <div class="language-title"><?php esc_html_e('Select language', 'kute-boutique'); ?> </div> <div class="language-topbar"> <div class="lang-list"> <ul class="clearfix"> <?php /** * @var $main_language bool|string * @used_by menu/language-selector.php */ foreach ($active_languages as $k => $al) { ?> <li <?php if ($al['active'] == 1) { ?> class="active" <?php } ?> > <a href="<?php echo esc_url($al['url']); ?> "> <img title="<?php echo esc_attr($al['native_name']); ?> " src="<?php echo esc_attr($al['country_flag_url']); ?> " alt="<?php echo esc_attr($al['language_code']); ?> " /> </a> </li> <?php } ?> </ul> </div> </div> </div> <?php } ?> <?php }