Last active
May 15, 2018 09:24
-
-
Save giventofly/995c46c1e213551f178f9e357aa3ea35 to your computer and use it in GitHub Desktop.
WPML wordpress custom menu links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//WPML home page link | |
$my_home_url = apply_filters( 'wpml_home_url', get_option( 'home' ) ); | |
//WPML get current active language | |
if ( defined( 'ICL_LANGUAGE_CODE' ) ) { | |
$activeen = ''; | |
$activept = ''; | |
//get current page/post id | |
global $wp_query; | |
$imthispage = $wp_query->post->ID; | |
//get the perm link | |
$purl = get_the_permalink($imthispage); | |
$linkpt = apply_filters( 'wpml_permalink', $purl , 'pt-pt' ); | |
$linken = apply_filters( 'wpml_permalink', $purl , 'en' ); | |
//PT | |
if(ICL_LANGUAGE_CODE == 'pt-pt') { $activept = 'active';} | |
//EN | |
if(ICL_LANGUAGE_CODE == 'en') { $activeen = 'active'; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment