Skip to content

Instantly share code, notes, and snippets.

@mafsdisseny
Last active October 15, 2018 16:33
Show Gist options
  • Save mafsdisseny/c199d37a292a0ebcf1aa to your computer and use it in GitHub Desktop.
Save mafsdisseny/c199d37a292a0ebcf1aa to your computer and use it in GitHub Desktop.
Polylang language switcher with slugs, uses Genesis
//* Add language switcher polylang with slug inspite of names
//* Position header-right
add_action( 'genesis_header_right', 'custom_language_switcher');
function custom_language_switcher() {
echo '<ul class="custom-lang-switcher">';
pll_the_languages(array('show_names'=>1,'display_names_as'=>'slug'));
echo '</ul>';
}
ul.custom-lang-switcher {
display: inline-block;
border-right: 1px solid;
font-size: $font-size-S;
li {
float: left;
margin-right: 15px;
border-left: 1px solid;
padding-left: 15px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment