• Resolved KodeFor.Me

    (@merianos)


    Hello.

    I use WordPress 3.0.3 and in my functions.php I use this code to register three menu positions in my theme :

    register_nav_menus(
        array(
            'main_navigation_menu' => 'Main Menu',
            'footer_links' => 'Footer links',
            'blogroll' => 'Blog Roll',
            'latest_wordpress' => 'Latest WordPress Download'
        )
    );

    Then in my theme I use this code to create the menu positions :

    // Code for my main menu
    wp_nav_menu(
        array(
            'menu' => 'Main Menu',
            'container' => '',
            'menu_class' => 'main_menu',
            'menu_id' => 'menu-main-menu'
        )
    );
    
    // Code for my first side bar menu
    wp_nav_menu(
        array(
            'menu' => 'Latest WordPress Download',
            'container' => '',
            'menu_class' => 'latest_wordpress_download'
        )
    );
    
    // Code for my second side bar menu
    wp_nav_menu(
        array(
            'menu' => 'Blog Roll',
            'container' => '',
            'menu_class' => 'main_menu'
        )
    );
    
    // Code for my footer menu
    $args = array(
        'menu' => 'Footer links',
        'container'=>'',
        'menu_id' => 'footer_links'
    );
    
    wp_nav_menu($args);

    Finally in my back end I create four menus (i.x: “Main menu”, “Side Menu #1”, “Side Menu #2” and “Footer”) and then I assign each of this menus in my menu positions that I have register thru the functions.php

    The problem is that the menu position “Latest WordPress Download” display the “Main menu”.

    Any idea on how to solve this problem please ??

    Kind regards
    Merianos Nikos

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter KodeFor.Me

    (@merianos)

    Somebody to help please ?

    place the code in function.php

    function register_primary_menu() {
    register_nav_menu( ‘primary-menu’, __( ‘Primary Menu’ ) );
    }
    function register_left_menu1() {
    register_nav_menu( ‘left-menu1’, __( ‘Left Menu 1’ ) );
    }
    function register_left_menu2() {
    register_nav_menu( ‘left-menu2’, __( ‘Left Menu 2’ ) );
    }
    add_action( ‘init’, ‘register_primary_menu’ );
    add_action( ‘init’, ‘register_left_menu1’ );
    add_action( ‘init’, ‘register_left_menu2’ );

    <?php if ( function_exists(‘has_nav_menu’) && has_nav_menu(‘primary-menu’) ) {

    wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘container’ => ‘ul’, ‘theme_location’ => ‘primary-menu’ ) );

    } ?>

    <?php if ( function_exists(‘has_nav_menu’) && has_nav_menu(‘left-menu1’) ) {

    wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘container’ => ‘ul’, ‘theme_location’ => ‘left-menu2’ ) );

    } ?>

    Add this where ever you need to display the menu

    any help needed you can contact me

    [email protected]
    https://inovawe.com

    Make sure you go to your menu option and select the theme location.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WordPress 3.0.3 custom menus (register_nav_menus)’ is closed to new replies.