CODE CODIFY.CLUB

WP WPML Link language

// TO DISPLAY LANGUAGE FLAG
<?php language_selector_flags(); ?>


// CREATE CURRENT PAGE LINK IN ANOTHER LANGUAGE
$url = get_the_permalink();

$wpml_permalink = apply_filters( ‘wpml_permalink’, $url , ‘fr’ );


// LANGUAGE CHECK
if(ICL_LANGUAGE_CODE==en){…}


// CUSTOM
<div class=”lang-bar”>
<?php
$languages = icl_get_languages(‘skip_missing=0&orderby=code’);
if(!empty($languages)){
$count=1;
foreach($languages as $l){

if(!$l[‘active’]) echo ‘<a href=”‘.$l[‘url’].'”>’;
echo $l[‘translated_name’];
if($count==’1′)echo “&nbsp;<span>|</span>&nbsp;”;
if(!$l[‘active’]) echo ‘</a>’;
$count++;
}
}
//echo $_SESSION[‘design’];
?>
</div>

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed