0

I am trying to convert a pure html theme to wordpress theme. I need to know how to make the navigation menus in the html theme (now it is on the way to converting to wordpress theme) for functioning properly. I registered the menu in functions.php

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

What else i need to do, please help. Thanks in advance.

1

Now where you want the menu in your theme, add something like this:

if (has_nav_menu( 'header-menu' )) { wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); }

  • Ok, thank you for your valuable time..also please let me know how to create navigation menu view or how to make the current navigation menu in html as 'header-menu'? – A Mak Aug 23 '18 at 3:53
  • You don't do it in HTML. Once you have all that in place, just go into wp-admin, create a menu, and assign it to the location "Header Menu" – De Coder Aug 23 '18 at 5:03
  • Ok thank you..how can i get the exact styles for menus as in html theme? Currently menus are appearing but style are not applied..Thank you for your valuable time. – A Mak Aug 23 '18 at 16:41
  • Create a stylesheet, and enqueue it. – De Coder Aug 23 '18 at 17:09
  • Thank you for your time. The css file having the styles for the menu is already en-queued. But how to specify the styles to be applied for that menu when the menu is called using the above php code? or is there any other method to add the class/id for the menu to be appeared? – A Mak Aug 23 '18 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.