WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven: Move menu to top (12 posts)

  1. lmw
    Member
    Posted 2 years ago #

    Can anyone point me in the right direction to moving the menu in Twenty Eleven to above the header?

    I'm guessing I need to add something to my functions.php to remove 'access' from its current position, then hook it in again above the header?

    Up to now I've only worked with the Thematic theme. I thought I shd learn how to manipulate another theme.

    Any pointers appreciated!!!

  2. Josh Leuze
    Member
    Posted 2 years ago #

    Are you editing Twenty Eleven directly, or are you using a child theme?

    You can move the menu by editing the header.php file, cut this code, starting on line #112:

    <nav id="access" role="navigation">
    				<h3 class="assistive-text"><?php _e( 'Main menu', 'twentyeleven' ); ?></h3>
    				<?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
    				<div class="skip-link"><a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?></a></div>
    				<div class="skip-link"><a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?></a></div>
    				<?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
    				<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    			</nav><!-- #access -->

    And paste that after the header opening tag, on line #73. This will put the menu at the top of the header above the title, description, and header image.

  3. lmw
    Member
    Posted 2 years ago #

    Child theme.... always a child theme....

    Ah-ha! Thanks JLeuze. I had tried to move the contents of <nav> but I had moved it to the wrong place (not far enough up).

    Thanks again!

  4. Josh Leuze
    Member
    Posted 2 years ago #

    You're welcome!

  5. raymondmah
    Member
    Posted 2 years ago #

    I am trying to follow the above instructions using a child theme.

    Do I simply copy and past the whole original Twentyeleven header.php file into the child theme folder and them make the amendment/rearrangement instructed above?

    I ask this because I have also read that the child theme file (in this case the child theme header.php) is only supposed to contain the parts to be amended. But in order to "rearrange" the code, will the whole original header php.file need to be reproduced?

    Thanks!

  6. alchymyth
    Forum Moderator
    Posted 2 years ago #

    simply copy and past the whole original Twentyeleven header.php file into the child theme folder and them make the amendment/rearrangement instructed above?

    yes

    have also read that the child theme file (in this case the child theme header.php) is only supposed to contain the parts to be amended

    this only applies definitively to functions.php and preferrably to style.css

  7. zendacomunicacion
    Member
    Posted 1 year ago #

    Hi, i found this post very useful... How would be the best practice to center the menu items? Instead of the default Left positioning?
    Thanks in advanced!

  8. harald_weist
    Member
    Posted 1 year ago #

    i have a similar question
    i copied the menu above the image, but now the submenu is not realy working
    http://bpk-tagungszentrum.de
    [Login details redacted. NEVER post sensitive information on a public forum!]
    what can i do?
    best harry

  9. harald_weist
    Member
    Posted 1 year ago #

    sorry - its the item Über uns and Kontakt on the right hand side of the menu

  10. esmi
    Forum Moderator
    Posted 1 year ago #

    Please post your own topic.

  11. Musicalman
    Member
    Posted 1 year ago #

    Thank you Josh, an old topic but just what I was looking for it worked a treat! :)

  12. Josh Leuze
    Member
    Posted 1 year ago #

    @Musicalman You're welcome!

Topic Closed

This topic has been closed to new replies.

About this Topic