Skip to content

Instantly share code, notes, and snippets.

@aymenbz
Forked from mafsdisseny/functions.php
Created October 15, 2018 16:33
Show Gist options
  • Save aymenbz/34f21a968d3475b15ccfba3a5d4e0970 to your computer and use it in GitHub Desktop.
Save aymenbz/34f21a968d3475b15ccfba3a5d4e0970 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