Skip to content

Instantly share code, notes, and snippets.

@mattradford
Last active June 19, 2022 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattradford/925661448c50aac79bb54bcfe5760051 to your computer and use it in GitHub Desktop.
Save mattradford/925661448c50aac79bb54bcfe5760051 to your computer and use it in GitHub Desktop.
Add Polylang language switcher to GeneratePress navigation
/**
* Add Polylang language switcher before GeneratePress navigation
*
* @link https://polylang.pro/doc/function-reference/
*/
if ( ! function_exists( 'generate_navigation_position' ) || ! function_exists( 'pll_the_languages' )) {
function mattrad_add_switcher() {
pll_the_languages([
'dropdown' => 1,
'hide_if_empty' => 1,
]);
}
add_action( 'generate_before_navigation', 'mattrad_add_switcher' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment