Custom switcher: Hide current lang
-
Hello. I created a shortcode to show the lang switcher. This is my code:
add_shortcode('custom-language-switcher', 'trpc_custom_language_switcher', 10); function trpc_custom_language_switcher(){ // Check whether TranslatePress can run on the current path or not. If the path is excluded from translation, trp_allow_tp_to_run will be false if ( apply_filters( 'trp_allow_tp_to_run', true ) ){ $languages = trp_custom_language_switcher(); $html = "<ul class='lang-list' data-no-translation>"; foreach ($languages as $name => $item) { $html .= "<li>"; $html .= "<a href='{$item['current_page_url']}'>"; $html .= "<span>{$item['short_language_name']}</span></a></li>"; } $html .= "</ul>"; return $html; } }
I want to show only the opposite lang (Hide the current lang). Is it possible? thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.