How to Style WP Nav Menu

If you’re creating your own theme and use adding a menu using the standard WordPress function wp_nav_menu(), you will have to style it using CSS in order to make it like the usual navigation menu. This function will return a list of menus you defined or added in Appearance -> Menus.


This looks fine if you will place it on the sidebar and you might just want to change font styles, colors, etc. However, if you want top place it at the header or footer, you surely want a vertical navigation menu.

In order to achieve the desired vertical navigation menu, you will need to add css codes. Don’t forget to consider the sub menus which should be hidden by default and will only be displayed once it’s parent menu item is hovered. It must also be responsive.

Well, this task isn’t that complex and you can use css and jquery to achieve the desired output.

However, since I’m using this function often, I feel like rewriting the same codes for each navigation menu is a bit time consuming. So, I created a jquery function that I can add to my theme/plugin files, and just call it.

Here it is:

[insert-code id=1]

The output of this functon is vertical navigation menu and accepts submenus. It’s also mobile responsive.

You can now add styling such as color, background, font styles, etc. in order to match it with the rest of the website.

Leave a Reply