How to add an area for the menu when creating / editing a theme for a VP? so that it is in the admin area there are areas for menus available. https://truemisha.ru/images/2014/07/wordpress-menu.png

    2 answers 2

    In function.php

     function theme_register_nav_menu() { register_nav_menu( 'primary', 'Primary Menu' ); } add_action( 'after_setup_theme', 'theme_register_nav_menu' ); 
    • I didn’t understand how to fasten the point in which I want to bring up the menu in the right place in the code of the page) - The Os
    • Ask a new question. Just formulate it somehow. Nothing is clear from what was said. - KAGG Design
    • If one of the proposed answers suits, it is worth noting as accepted - KAGG Design
    • I registered primary. Now in the template file you need to add $ args = array ('theme_location' => 'primary'); wp_nav_menu ($ args); is obtained? - The Os
    • Yes. Here is the real code from one of my sites: wp_nav_menu (array ('theme_location' => 'top', 'menu_id' => 'top-menu',)); - KAGG Design

    This is done with the wp_nav_menu function wp_nav_menu
    cm
    https://developer.wordpress.org/reference/functions/wp_nav_menu/
    https://wp-kama.ru/function/wp_nav_menu

    • This is a conclusion on the screen, and he asks about the registration of the menu so that there are areas in the admin panel. - KAGG Design
    • "How to add a region" .. where, if not to the theme template? However, landmarks are given, there is from where to dance. add_theme_support you should start with add_theme_support and do not forget about register_nav_menus ;) - SeVlad
    • And the funny thing (or sad) is that the source of the screen about it tells everything. - SeVlad
    • took a screenshot from google images, did not check the source - The Os
    • one
      If you read, it will help. Everything is chewed up there and there is no water (volker is not needed, this is the next step, and there is a separate song about the styles, and the rest is all that is needed). And the link that I gave in the answer, too. - SeVlad