-
AuthorPosts
-
May 22, 2013 at 7:06 pm #23672
Hello I am using Enfold with large fixed menu and social icons. Is there a way to add the language switcher flag to the right of the head section?
May 23, 2013 at 2:47 am #120746Hi,
Edit header.php then find this code
do_action('avia_meta_header');Below, place this code
do_action('icl_language_selector');Then add this on your custom.css
#lang_sel a {
border: none;
}
#lang_sel {
right: -60px;
top: -10px;
}
#lang_sel a.lang_sel_sel {
background: url(../img/nav-arrow-down.png)right no-repeat;
color: #444;
}Change the top and right properties to position the switcher.
Cheers,
Ismael
May 28, 2013 at 8:45 am #120747If you just like to embed the flag icons, you may need to follow these steps:
Open functions.php, locate in line 362
add_theme_support( 'avia_post_meta_compat');Below add:
/*
* F1 add: Language selector (flags) function for header (right menu)
*/
function header_lang_flags(){
$languages = icl_get_languages('skip_missing=0&orderby=code');
if(!empty($languages)){
echo '<ul>';
foreach($languages as $l){
echo '<li>';
if($l['country_flag_url']){
if(!$l['active']) echo '<a href="'.$l['url'].'">';
echo '<img src="'.$l['country_flag_url'].'" alt="'.$l['native_name'].'" title="'.$l['native_name'].'" />';
if(!$l['active']) echo '</a>';
}
echo '</li>';
}
echo '</ul>';
}
}Then open up header.php, locate on line 113:
do_action('avia_meta_header');Add below:
header_lang_flags();Have fun.
May 29, 2013 at 7:07 am #120748Hey!
formateins – thanks for the hint :)
Best regards,
Peter
May 29, 2013 at 7:56 am #120749NP! :)
PS: You should put all your codestuff to an extra file (name it like functions-my.php). Put your functions to it and just add require_once(“functions-my.php”); to the functions.php.
This saves some time, if Kriesi updates the theme. It’s probably easier and quicker than building a child theme. :)
-
AuthorPosts
- The topic ‘WPML Language switcher in header?’ is closed to new replies.
