Topic: How to create a wordpress side menu with sub items?

VenusSModzHD free asked 6 years ago


<li><a class="collapsible-header waves-effect arrow-r"><i class="fa fa-chevron-right"></i> Submit blog<i class="fa fa-angle-down rotate-icon"></i></a>
 <div class="collapsible-body">
 <ul>
 <?php wp_nav_menu( array( 
 'theme_location' => 'navbar'
 )); 
 ?>
 </ul>
 </div>
 </li>

Witold Tkaczyk free answered 6 years ago


Hi Venus,

you need to register menu first using this code:

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

then you can add dimensions to your menu in: ../wp-admin/nav-menus.php

after this you can simply display your new menu using:

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

here you can find more information.

Best,
Witek



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags