WordPress.org

Ready to get started?Download WordPress

Forums

Twentyeleven header menu (4 posts)

  1. crowd
    Member
    Posted 1 year ago #

    I'm using the child of twentyeleven.
    There is no problem creating any sidebar menu, but i would like to customize the horizontal menu in the header. Now it shows all the pages i have, but I need it to display only the pages i choose. In the widget page i can only customize sidebars menus, but not the upper one in the header. How can i do it?

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

  3. crowd
    Member
    Posted 1 year ago #

    alchymyth, thank you very much for the link, it helped.

    For those who might come across the same issue, let me show what i did:

    1. Add this code in functions.php

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

    2. In header.php find

    <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>

    and replace it with

    <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>

    3. See Appearance >> Menus Theme Location box. The Header Menu drop-down should appear there.

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    ??

    First up, never modify 2011, always use a child theme - http://vudu.me/child

    Next up, all you had to do was create a menu!!

    All you did above was create a new menu, and use it to replace the menu that already existed in 2011.

    In 2011, your pages are displayed by default. But all you had to do was create a custom menu and assign it in the menus interface, and it would have replaced the page listing! No need to creat a new menu.

Topic Closed

This topic has been closed to new replies.

About this Topic