WPML compatibility

This commit is contained in:
champsupertramp
2016-01-10 22:30:57 +08:00
parent 0e10428126
commit 30af5aac35
2 changed files with 51 additions and 8 deletions
+18
View File
@@ -151,6 +151,24 @@ class UM_Permalinks {
}
}
// WPML compatibility
if ( function_exists('icl_object_id') ) {
$language_code = ICL_LANGUAGE_CODE;
$lang_post_id = icl_object_id( $page_id , 'page', true, $language_code );
if($lang_post_id != 0) {
$profile_url = get_permalink( $lang_post_id );
}else {
// No page found, it's most likely the homepage
global $sitepress;
$profile_url = $sitepress->language_url( $language );
}
}
if ( um_get_option('permalink_base') == 'user_login' ) {
$user_in_url = um_user('user_login');