Forums

[resolved] nav menu has standard page list instead of the custom menu (3 posts)

  1. xuzi
    Member
    Posted 9 months ago #

    I'm modifying an older theme "fog" and I've updated it to support menus according to the tutorials, forums, codex etc. Here's what I put into my functions.php file:

    add_action( 'init', 'register_my_menus' );
    function register_my_menus() {
    register_nav_menus(
    array(
    'header-menu' => __( 'Header Menu' ),
    'extra-menu' => __( 'Extra Menu' )
    )
    );
    }

    and here's what I put into my header.php:

    <div id="nav">
    <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
    </div>

    I created a custom menu and ordered it the way I wanted. It works perfectly behind the scenes while I'm using "theme test drive" (there's a coming soon theme - makeover - that is live while I'm building the site).

    When I activate the fog theme, however, the nav menu becomes the entire page list, ordered alphabetically instead of the custom menu. I've examined everything and can't see what is wrong. Any help would be greatly appreciated!

  2. xuzi
    Member
    Posted 9 months ago #

    Here's the site link in case it will help, although it is working fine in this theme-test-drive enabled view.

  3. xuzi
    Member
    Posted 9 months ago #

    Never mind, I found a solution! After quite a lot of code wrestling, I triumphed. Here's what worked, thanks to the insight on this page.

    It had to do with wp_nav_menu ... I put this into the argument instead of the earlier code:

    <div id="nav">
    <?php wp_nav_menu( array( 'theme_location' => 'header-menu','menu' => 'header-menu', ) ); ?>
    </div>

    And note to self ... use templates made for current version of WordPress from now on!

Reply

You must log in to post.

About this Topic