-2

I'm make small theme for company. We have html code made by fronted developer. How will be code menu from html to wordpress by php.

  <nav class="top-nav">
      <a href="">О студии</a>
      <a href="pricing.html">Стоимость работ</a>
      <a href="">Галерея работ</a>
      <a href="">Важное о наращивании</a>
  </nav>
1

First step is to register the name (or names) for your menus. In your example, top-nav seems appropriate.

function vd_register_menu() {
  register_nav_menu('top-nav',__( 'Top Nav Menu' ));
}
add_action( 'init', 'vd_register_menu' );

This will allow you to build your menu items in the WP admin under Appearance > Menus.

To display your menu on the site, simply call the wp_nav_menu() function where you wish to print the code.

<?php wp_nav_menu( array( 'theme_location' => 'top-nav' ) ); ?>

Full documentation available via WP Codex: https://codex.wordpress.org/Navigation_Menus

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.