Register nav menus for your cool wordpress theme

register nav menus function code image

Register nav menus only if you are planning to run multiple navigations. Most of the developers are doing this for the footer section of their content. The main idea is to make them more comfortable while browsing their content. This tutorial is all about coding for the same. Also, a complete list of chapters are available in the general theme development post.

Now let’s start coding our theme. First of all, the system is similar to my previous post. However, that was for a single menu content. On the other hand, this specific tutorial is about registering multiple items for your users.

First of all, we will open the functions dot php page and write down the same codes again. Function is the first word. Then we need to write our theme name. However, you can write any name you want. After that, we will be writing custom underscore menu. Next, we will put the first bracket.

Next code is the second bracket. Also, we will write all the codes in between the second bracket. Let’s name that as (my custom menu). Don’t forget to put inverted comma while writing the custom menu code. Moreover, you can put a comma and write the text domain. That is called standard coding. So, you can simply write (my custom menu) for your text domain after putting comma. However, the best suggestion is to write your own domain name.

Finally, we will be adding action for the function. Therefore, we will be writing that as add action and put first bracket. After that, we will write the init code to function it properly. Finally, we will call the function name again. Please make sure, that the name must need to match the first written name. We may repeat same and register nav menus.