Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function jnews_language_switcher() {
- if ( function_exists( 'pll_the_languages' ) ) {
- $parameter = apply_filters(
- 'jnews_top_lang_param',
- array(
- 'dropdown' => 0,
- 'echo' => 0,
- 'hide_if_empty' => 1,
- 'menu' => 0,
- 'show_flags' => 1,
- 'show_names' => 1,
- 'display_names_as' => 'name',
- 'force_home' => 0,
- 'hide_if_no_translation' => 0,
- 'hide_current' => 1,
- 'post_id' => null,
- 'raw' => 0,
- )
- );
- echo "<ul class='jeg_nav_item jeg_top_lang_switcher'>" .
- pll_the_languages( $parameter ) .
- '</ul>';
- } elseif ( function_exists( 'icl_get_languages' ) ) {
- $languages = icl_get_languages( 'skip_missing=0&orderby=code' );
- if ( ! empty( $languages ) ) {
- $output = '';
- $select_text = 'Select Language';
- $my_current_lang = apply_filters( 'wpml_current_language', null );
- /* check the language CODE and change the Select Lnguage Teks */
- if ( $my_current_lang === 'id' ) {
- $select_text = 'Beralih Bahasa';
- } elseif ( $my_current_lang === 'ja' ) {
- $select_text = 'Select Language';
- }
- foreach ( $languages as $language ) {
- $output .= '<a href="' . esc_url( $language['url'] ) . '" data-tourl="false">
- <img src="' . esc_url( $language['country_flag_url'] ) . '" title="' . esc_attr( $language['native_name'] ) . '" alt="' . esc_attr( $language['code'] ) . '" data-pin-no-hover="true">
- <span>' . esc_html( $language['native_name'] ) . '</span>
- </a>';
- }
- echo "
- <div class='jeg_top_lang_switcher_dropdown'>
- <button class='jnews-lang-custom-dropdown-btn'>{$select_text}</button>
- <div class='dropdown-content'>
- {$output}
- </div>
- </div>
- ";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement