Skip to content

Commit

Permalink
#2721 Added in Master
Browse files Browse the repository at this point in the history
  • Loading branch information
Zabi09 committed Feb 8, 2019
1 parent 7908ff6 commit b9dba79
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 4 additions & 1 deletion includes/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ function ampforwp_page_template_redirect() {
session_destroy();
}
}

if ( function_exists('weglot_plugin_loaded') ) {
$url_to_redirect = ampforwp_get_weglot_url();
$url_to_redirect = ampforwp_url_controller($url_to_redirect);
}
// Check if we are on Mobile phones then start redirection process
if ( wp_is_mobile() ) {

Expand Down
17 changes: 16 additions & 1 deletion templates/features.php
Original file line number Diff line number Diff line change
Expand Up @@ -7812,4 +7812,19 @@ function ampforwp_subtitles_support(){
<?php
}
}
}
}
if ( ! function_exists('ampforwp_get_weglot_url') ) {
function ampforwp_get_weglot_url(){
$url = weglot_get_full_url_no_language();
$current_lang = weglot_get_current_and_original_language();
$original_lang = $current_lang['original'];
$current_lang = $current_lang['current'];
if($current_lang == $original_lang ){
return $url;
}else{
$url = trailingslashit($url) . $current_lang;
return esc_url(user_trailingslashit($url));
}

}
}

0 comments on commit b9dba79

Please sign in to comment.