Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am developing a theme of my own. In functions.php I added -

add_action( 'init', 'register_my_menus' ); 

function register_my_menus() { register_nav_menus( array(

         'front_login_menu' => _( 'front_login_menu location'),
         'top_front_general_menu' => _( 'top_front_general_menu'),
         'top_general_menu' => _( 'top_general_menu'),
         'top_student_menu' => _( 'top_student_menu'),
         'top_admin_menu' => _( 'top_admin_menu'), 
         'top_trainer_menu' => _( 'top_trainer_menu' ) ) ); }

Then I created the custom menus in the admin panel. But suddenly I found that those menus except one are not visible in the right side of the Appearance -> Menus page in online server but the theme locations do exist. But those menus are visible in my localhost. I was supposed to create them (some if not all) in online server too.

If I want to create one of those missing menus then the message says:

The menu name .... conflicts with another menu name. Please try another.

How can I get those menu names appear in the right side of the theme locations?

share|improve this question
    
Try a very basic check, copy the menu name and in your editor try to find (typically Ctrl + F) the same keyword exist somewhere else. If so, dissolve the conflict. For function name try something different than register_my_menus. And moreover try debugging turned on into your WP installation. –  Mayeenul Islam Oct 6 '13 at 13:17
    
@MayeenulIslam, I changed all the menu names and theme locations. The problem is when I create a menu after another one the previous menu disappears so I cannot add any menu item to the previous one. How to get rid of this situation ? –  Istiaque Ahmed Oct 6 '13 at 13:40
add comment

1 Answer

I don't think you need to initiate the menus again where register_nav_menus() itself is an initiator.

Syntax: <?php register_nav_menu( 'your-menu-handle', 'Your Menu Label' ); ?>

Copy the following code and Paste them into your functions.php without any function or add_action(), I hope it'll work:

register_nav_menus(
    array(
     'front_login_menu' => __( 'Front Login Menu location'),
     'top_front_general_menu' => __( 'Top Front General Menu'),
     'top_general_menu' => __( 'Top General Menu'),
     'top_student_menu' => __( 'Top Student Menu'),
     'top_admin_menu' => __( 'Top Admin Menu'), 
     'top_trainer_menu' => __( 'Top Trainer Menu' )
    )
);

Use the following code into your theme, where you want to show the menu:

<?php wp_nav_menu (
            array (
                'theme_location'=>'front_login_menu', //change the slug here where necessary
                'fallback_cb'=>''
            )
        ); ?>
share|improve this answer
    
did not solve the question. The online server has prob in its mysql DB. Thinking whether it is related with that, –  Istiaque Ahmed Oct 6 '13 at 14:35
    
How the menu codes are connected with your db prob - I'm thinking of that too. Ok, I did a minor edit with a double underscore (__()) instead of single underscore (_()). (know why) –  Mayeenul Islam Oct 6 '13 at 14:43
1  
When the Browse tab of the Db table was clicked, it showed error. This problem was solved and the menu names also appeared in place. –  Istiaque Ahmed Oct 10 '13 at 7:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.