Home>Support>Google Language translator on Primary Nav (Menu bar)

Google Language translator on Primary Nav (Menu bar)

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

After search on internet, I’ve found some code how to put Google Translator (Google Language Translate plugins, link plugins :http://www.studio88design.com/wordpress-plugins/google-language-translator/).

these codes is for Genesis Themes, I’ve found on 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;
}

the problem for me is how to insert in my menu bar (primary navigation, simetris with home, about us, etc).
not on top right on primary navigation.
Where should I put code like that on Vantage Themes ?
Is it possible to add those codes in menu.php , masthead-logo-in-menu.php ?

FYI, I develop my website with Vantage Premium Themes.
as you can see, I created Primary Navigation (Menu Bar), as look like as Header Masthead, but trully it’s just Primary Navigation (style Logo In Menu Bar) with an image background, that is not header.

For now, I just put on top right with adding code on masthead.php :

 * Part Name: Logo In Menu
 */
?>
<?php echo do_shortcode('[google-translator]'); ?>
<header id="masthead" class="site-header masthead-logo-in-menu" role="banner">

	<nav role="navigation" class="site-navigation main-navigation primary <?php if( siteorigin_setting('navigation_use_sticky_menu') ) echo 'use-sticky-menu' ?>">
		<div class="full-container">

			<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home" class="logo"><?php vantage_display_logo(); ?></a>

			<?php if( siteorigin_setting('navigation_menu_search') ) : ?>
				<div id="search-icon">
					<div id="search-icon-icon"><div class="icon"></div></div>
					<form method="get" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
						<input type="text" class="field" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" />
					</form>
				</div>
			<?php endif; ?>

			<?php wp_nav_menu( array( 'theme_location' => 'primary', 'link_before' => '<span class="icon"></span>' ) ); ?>
		</div>
	</nav><!-- .site-navigation .main-navigation -->

</header><!-- #masthead .site-header -->

And then Google Translator just shown on top right of background Primary Navigation, not on place as same as home, about us, prtfolio, find us place.

Really appreciate for any suggestion.

best regards
cahy

URL: http://www.dutaflow.co.id

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 10 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Hi Cahy

    The snippet you’ve posted is specific to the Genesis framework so not something that can be easily transferred over to Vantage.

    To confirm; you’re wanting to put the translator flags at the end of your menu?

  2. 10 years, 10 months ago AS Cahyono

    Yes that what I want ..
    can’t wait your help
    thanks

    best regards
    cahy

  3. 10 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Please give me a little more time on this. What we’ll need to to do is perhaps introduce a widget area into the menu, I’m not sure that I can do this within our support offering but don’t mind taking a look. I’ll revert ASAP.

  4. 10 years, 10 months ago AS Cahyono

    Hi Andrew
    thanks for quick response
    sure I’ll wait for vantage update

    best regards
    cahy

  5. 10 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    Here is a child theme you could try. If you have a child theme already running then you’ll just need to use the functions.php file from this child theme as well as the single selector I’ve inserted into style.css.

    https://siteorigin.com/wp-content/uploads/2014/09/vantage-child-menu-widget-area1.zip

    You can install the child theme from Appearance > Themes > Add New: Upload Theme. Child themes do require you to redo Appearance > Customize and Appearance > Menu settings.

    It’s not a super intelligent solution. It assumes you’re not using the search in menu option. Once installed a new widget area will be available at Appearance > Widgets. You can adjust where the widget you add is positioned using the selector you’ll find in the style.css file of the child theme. You can edit this via Appearance > Editor once the child theme is activated. Below that you’ll find a breakpoint as you might need to shift your widget up into the header below a certain resolution. You can adjust this breakpoint and what happens at that breakpoint using the second selector in style.css of the child theme.

    Try the child theme and decide whether it works before redoing any Customizer settings.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More