WordPress – Mailchimp Integration Multicountry

Description

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset she

Code

add_action('wp_loaded', 'my_icl_set_current_language');
function my_icl_set_current_language() {
       
if ($_SERVER['REQUEST_URI'] == '/' OR $_SERVER['REQUEST_URI'] == '/es/' OR $_SERVER['REQUEST_URI'] == '/en/' OR $_SERVER['REQUEST_URI'] == '/de/' OR $_SERVER['REQUEST_URI'] == '/nl/' OR $_SERVER['REQUEST_URI'] == '/fr/') {          

if ( isset( $_COOKIE['UserLanguage']) ){

                  // echo 'Cookie is set!
'; // echo "Value is: " . $_COOKIE['UserLanguage']; } else { $lang = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']); setcookie("UserLanguage", $lang, time() + 86400, "/"); setcookie("UserLanguage", $lang, time() + 86400, "/es/"); setcookie("UserLanguage", $lang, time() + 86400, "/fr/"); setcookie("UserLanguage", $lang, time() + 86400, "/de/"); setcookie("UserLanguage", $lang, time() + 86400, "/nl/"); setcookie("UserLanguage", $lang, time() + 86400, "/en/"); if (($lang=="it_IT") OR ($lang=="it-IT")) { wp_redirect( "/" ); exit(); }else if (($lang=="es_ES") OR ($lang=="es-ES")) { wp_redirect( "/es/" ); exit(); }else if (($lang=="fr_FR") OR ($lang=="fr-FR")) { wp_redirect( "/fr/" ); exit(); }else if (($lang=="de_DE") OR ($lang=="de-DE")) { wp_redirect( "/de/" ); exit(); }else if (($lang=="nl_NL") OR ($lang=="nl-NL")) { wp_redirect( "/nl/" ); exit(); } else { wp_redirect( "/en/" ); exit(); } } } else { } }