L
L
ligisayan2015-08-27 10:59:20
PHP
ligisayan, 2015-08-27 10:59:20

Why doesn't the new menu appear in the wordpress admin?

Greetings. There is a shop on wordpress woocomerce. I want to add my menu to the topic. I add the code to the functions.php file:

function register_my_menu()
{
register_nav_menu
(
array( 'header-menu' => 'header-menu1')
);
}
if (function_exists('register_nav_menu'))
{
     add_action( 'init', 'register_my_menu' );
}

and output inside the template:
<nav>
  <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
</nav>

The menu is displayed on the site, but I don’t have the ability to edit it from the admin panel, because does not find it in the menu sub-item. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CrewCut, 2015-08-27
@ligisayan

Try changing the function code to:

function theme_register_nav_menu() {
  register_nav_menu( 'header-menu', 'Моё супер-меню' );
}
add_action( 'after_setup_theme', 'theme_register_nav_menu' );

Then in the admin panel - Appearance -\u003e Menu -\u003e Add new
Name it whatever you want and at the bottom, near the publish button, there will be checkmarks, among which there will be "My super-menu" - click and save. Now this menu will be displayed in the theme

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question