2.4k questions

2.4k answers

96.2k users

6 Online Users
0 Member 6 Guest
Today Visits : 191
Yesterday Visits : 2879
Total Visits : 2366120

Categories

Notice

Dear All, These are my answers from Quora and primarily Google; please check the answer and from others sites; the answers are free and without any liability.To make a decision, write down all of the positives and negatives on a piece of paper.Thank you,

Elias Katsaniotis, MSc

Information

Viktoria Katsanioti,

Kaliningrad,

Russia,

matizegr@yahoo.com

0 votes
65 views

How do you create a new menu location in WordPress?
in WordPress by (95.8k points)

1 Answer

0 votes
 
Best answer

From

Navigation Menus

https://codex.wordpress.org/Navigation_Menus

  1. We Register Menus

First, in your theme's functions.php, you need to write a function to register the names of your menus. (This is how they will appear in the Appearance -> Menus admin screen.) As an example, this menu would appear in the "Theme Locations" box as "Header Menu".

  • function register_my_menu() { 
  • register_nav_menu('header-menu',__( 'Header Menu' )); 
  • add_action( 'init', 'register_my_menu' ); 

    And this would make two menu options appear, header menu and extra menu -

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

      2. We add to Theme

      • <?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?> 
        by (95.8k points)
        ...