WordPress.org

Support

Support » Themes and Templates » moving menu from header to sidebar

moving menu from header to sidebar

  • Hi there everybody,

    I’m wp n00b, but I’m fluent in PHP. I’d like to move my nav-menu from header to the sidebar.

    The template I use (raindrops) generates horizontal menu in the header with this:
    wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’));

    In the sidebar I already have a list of pages generated with this:
    wp_list_pages(‘title_li=<h2 class=”h2″>’. __( ‘Pages’, ‘Raindrops’).'</h2>’ );

    I like the way that wp_list_pages renders everything, and I’d like to get the same result as wp_list_pages, but instead of list pages to get my primary navigation menu.

    How do I do that?

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    @esmi

    Forum Moderator

    You will need to move the call to wp_nav_menu() to sidebar.php to replace wp_list_pages. Depending upon how the theme’s CSS works, you may also have to make some changes to the stylesheet and/or the register_nav_menus() function in functions.php

    Well, yes. The point is that simply moving wp_nav_menu() gives me horizontal menu wrapped in several lines instead of vertical menu. So, yes, I could just write my own CSS from scratch for this particular menu.

    But I figured that I should be able to somehow tell wp_nav_menu() to use the same CSS that wp_list_pages() uses. Is that possible? Is there a way to make a function wp_list_only_pages_which_are_in_primary_menu() which produces the same results as wp_list_pages()?

    esmi

    @esmi

    Forum Moderator

    I doubt you’re going to be able to completely replicate the CSS for wp_list_pages via the wp_nav_menu parameters.
    http://codex.wordpress.org/Function_Reference/wp_nav_menu

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘moving menu from header to sidebar’ is closed to new replies.
Skip to toolbar