Support » Fixing WordPress » insert a plugin or a widget in the top menu

  • Hello everyone
    I would like to make my website multilingual and for now I use google language translator plugin.

    I would like to insert this plugin in the top menu of the website. How can I do?

    I’m inexperienced and I would like a detailed and detailed explanation if possible.

    Sorry for the text but I’m Italian and I used a translator.

    thanks for your kindness

Viewing 1 replies (of 1 total)
  • You first need to create a child theme of your theme. Then, in your child theme’s functions.php file, you want to add this function call to register your new widget area:

    // Register a new widget area
    if ( function_exists('register_sidebar') ) {
    		'name' => 'Menu Widget Area',
    		'id' => 'menu-widgets',
    		'description' => 'Appears as the widget area in the nav bar',
    		'before_widget' => '<li id="%1$s" class="widget %2$s">',
    		'after_widget' => '</li>',
    		'before_title' => '<h2 class="widgettitle">',
    		'after_title' => '</h2>', )

    Then, you need to make a copy of header.php in your child theme (I assume that header.php is the file that creates the top menu for your theme). Add the following code to the child theme’s header.php file where you want the widget area to appear:

    <?php if ( is_active_sidebar( 'menu-widgets' ) ) : ?>
    	<ul id="menu-widgets">
    		<?php dynamic_sidebar( 'menu-widgets' ); ?>
    <?php endif; ?>

    Now you can go to Appearance → Widgets and you should see your new widget area called Menu Widget Area. Drag your translation widget into it.

    You may need to add some CSS rules to style the widget properly.

Viewing 1 replies (of 1 total)
  • The topic ‘insert a plugin or a widget in the top menu’ is closed to new replies.