php 插件WPML

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 插件WPML相关的知识,希望对你有一定的参考价值。

------ switcher -----

https://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/

function wyethnutrition_language_switcher(){
    $languages = icl_get_languages('skip_missing=0&orderby=code');
    if( !empty( $languages ) ){
        foreach( $languages as $l ){
			if($l['language_code'] == 'ar'){
				$code = '?';
			}else{
				$code = ucfirst( $l['language_code'] );
			}
            if( !$l['active'] ) echo '<a href="'.$l['url'].'" class="language-link">'.$code.'</a>';
        }
    }
}

------ убирает dir="rtl" ------ 

function theme_language($text){
 return str_replace('dir="rtl"','',$text);
}
add_filter('language_attributes','theme_language',999);

以上是关于php 插件WPML的主要内容,如果未能解决你的问题,请参考以下文章

php wpml_element_link

php WPML启用功能

php WPML语言选择器修复

php WPML多语言短代码

php WPML语言菜单

php 自定义选择语言下拉列表wpml