WordPress 3.5 dropdown menu

I’m pretty new with WordPress and I want to create my own dropdown menu without the use of any plugins. I already did some research but there are some things I do not understand. In my header file I have the following code for my main menu:

<div id="navigation">
    <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</div>

I didn’t have to add any code in my functions.php file, it worked well without it. In most tutorials, you have to add this code in to the functions.php file, but for me it worked without this code.

Read More
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
    register_nav_menus( array(
        'main' => __( 'main' ),
    ));
}

When I want to add a custom menu in WordPress, I have to add something to this code:

add_action( 'init', 'register_my_menus' );
function register_my_menus() {
    register_nav_menus( array(
        'main' => __( 'main' ),
        **'secondary-menu' => __( 'Secondary Menu' ),**
    ));
}

From this moment on, I can see 3 menus in the backend (2X primary menu, 1X secondary menu).
I know this was a lot, but I have tried to be clear and I hope somebody will understand me. Can somebody please tell me where I’m going wrong?

Related posts

Leave a Reply

1 comment

  1. For the moment based on your question I am assuming you want a single menu, which when hovering over a menu item, its child items are displayed in a drop down menu.

    Following this tutorial should give you a horizontal menu with vertical drop downs:

    http://codex.wordpress.org/Creating_Horizontal_Menus

    Repeat for each menu you need.

    For more on defining and using menus themselves in PHP, refer to this article by Justin Tadlock:

    http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus