Last active
June 19, 2022 13:11
-
-
Save mattradford/925661448c50aac79bb54bcfe5760051 to your computer and use it in GitHub Desktop.
Add Polylang language switcher to GeneratePress navigation
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
/** | |
* 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