Many menus in different pages.

Discussion in 'BlackBird WordPress Theme' started by penz, Aug 8, 2014.

  1. penz

    penz New Member

    Joined:
    Aug 8, 2013
    Messages:
    17
    Likes Received:
    0
    Hi!

    I have a website on many languages (I used qtranslate).

    http://noeturkey.com/

    I would like every language to have his own menu so i tried this code in header.php (replacing this: <?php inkthemes_nav(); ?>):

    <?php


    if (qtrans_getLanguage()=='tr') {
    inkthemes_nav( array('menu' => 'Menu' ));
    } else {
    inkthemes_nav( array('menu' => 'Ingles' ));
    }


    ?>

    However this doesn't work. I'm asuming this is because "inkthemes_nav" will always send you to the Main Menu.

    What can I do? Thanks in advance.

    Diego.
     
  2. Naveen

    Naveen Guest

    Joined:
    Aug 8, 2014
    Messages:
    1,739
    Likes Received:
    64
  3. penz

    penz New Member

    Joined:
    Aug 8, 2013
    Messages:
    17
    Likes Received:
    0
    I'll send you an email. Cheers!
     
  4. penz

    penz New Member

    Joined:
    Aug 8, 2013
    Messages:
    17
    Likes Received:
    0
    Did you receive my email?
     
  5. Pramod

    Pramod Guest

    Joined:
    Aug 8, 2014
    Messages:
    2,847
    Likes Received:
    63
    Hello !

    We have got your email, and started working over it. We will reply you soon.

    Thanks & Regards
    Pramod Patel
     
  6. PankajK

    PankajK Support Staff

    Joined:
    Aug 8, 2014
    Messages:
    93
    Likes Received:
    5
    Hi penz
    I have fixed your issue by adding a new menu location. Now you have two menu locations named 'Main Menu' and 'Ingles'.
    You can now show different set of menus with different languages. If you add more languages and want different set of menus for all these languages, you have to create more menu locations by registering new menu locations.
    Thanks and Regards
    Pankaj Kumar
     

    Attached Files:

  7. penz

    penz New Member

    Joined:
    Aug 8, 2013
    Messages:
    17
    Likes Received:
    0
    Thanks man! Just to know. Where do I register new menu locations?
     
  8. PankajK

    PankajK Support Staff

    Joined:
    Aug 8, 2014
    Messages:
    93
    Likes Received:
    5
    Hi penz
    To add more menu locations you need to edit function.php file.
    Find these lines
    Code:
    function inkthemes_register_custom_menu() {
        register_nav_menu('custom_menu', __('Main Menu', 'black-bird'));
    }
    under this function add a new line
    register_nav_menu('custom_menu2', __('Menu2', 'black-bird'));
    The new code will look like
    Code:
    function inkthemes_register_custom_menu() {
        register_nav_menu('custom_menu', __('Main Menu', 'black-bird'));
    register_nav_menu('custom_menu2', __('Menu2', 'black-bird'));
    }
    This way you will able to register a new menu location.

    Now you need to call this menu from the location you want to appear.
    Add these codes where you want to show you new menu.

    Code:
    <?php wp_nav_menu(array('theme_location' => 'custom_menu2', 'container_id' => 'menu', 'menu_class' => 'ddsmoothmenu', 'fallback_cb' => 'inkthemes_nav_fallback')); ?>
    
    Please note that the id in theme location must be same as you added in the function.
    'theme_location' => 'custom_menu2'
    Now go to your dashboard under menu and you will find a new menu location 'Main Menu2'
    Thanks and Regards
    Pankaj Kumar
     

Share This Page