Add widget to menu

Hi Vlad!

Is there any way of adding a google translate box to the main menu in sydney?

I’m using the Prisna: Google Website Translator plugin but I guess this feature would be useful for any other plugin.

Thanks!!

Hi,

Don’t know how that plugin works. This tutorial shows how you can add custom things to your menu.

Thanks!! It worked, Vlad!

I added this code:

add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);
function add_search_box_to_menu( $items, $args ) {
    if( $args->theme_location == 'primary' )
        
    return do_shortcode('[prisna-google-website-translator]').$items;
}

And it shows in the menu like this:

Is there a way to put it after the ‘sales & contacts’ link? I don’t know much about this (setting up this website has been an amazing experiment!) but it almost feels like the translate box is apart, code-wise, from the rest of the links in the menu. It doesn’t show as a widget on customizer or page builder either…

Post a link to your site please.

It’s offline: I’m doing it on InstantWP. Can I send you some of the PHPs?

Nope, I would need to see it as this is probably CSS related. Let me know once you’re live and we’ll see.

Hmm maybe I can upload it to some server so you can check it? Can that be done?