vinay j
vinay j

Reputation: 305

how to create wordpress theme that has menu in the left side of the site and menu in the top

enter image description here

Hi, I am trying to find the theme like one in the above, Whether can I create a menu and put them in different positions.

Or I have to code it from the beginning??

Upvotes: -1

Views: 292

Answers (1)

Code Lover
Code Lover

Reputation: 8348

Register nav menu in your theme file. Usually in functions.php file. Once you register the nav menu than call it where you wan to show it. In your case sidebar.

If you want two different navigation items than you will have to register two navs. However, if you want the same nav items controlled from the same menu in admin area than you can register one nav and use the same for sidebar and header locations. Than you can play around with css to style differently.

Register single nav

function register_my_menu() {
  register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );

Register more than one navs

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

Call into the theme header

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

Call on sidebar

wp_nav_menu( array( 'theme_location' => 'sidebar-menu', 'container_class' => 'my_sidebar_menu_class' ) );

For more details you should checkout WordPress documentation for Navigation Menus

Upvotes: 1

Related Questions