Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add this in functions.php to insert a div that shows the output of Google Language Translator WordPress plugin. Details: http://sridharkatakam.com/how-to-add-google-translator-in-primary-navigation-of-genesis/
<?php
//* Do NOT include the opening php tag
add_filter( 'genesis_nav_items', 'sk_google_translator', 10, 2 );
add_filter( 'wp_nav_menu_items', 'sk_google_translator', 10, 2 );
function sk_google_translator($menu, $args) {
$args = (array)$args;
if ( 'primary' !== $args['theme_location'] )
return $menu;
ob_start();
echo '<div id="google-translator">' . do_shortcode("[google-translator]") . '</div>';
$google_translator = ob_get_clean();
return $menu . $google_translator;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.