How do I get Max Mega Menu to work in my custom theme?

There are no special requirements to get Max Mega Menu working with your custom theme, you only need to make sure you use the core WordPress functions to register and display your menu correctly.

Step 1 – Register a Menu Location

Use the register_nav_menu or register_nav_menus function to add a new menu location to your theme.

Add the following to your themes functions.php file:

Important: Make a note of the menu location ID. In the code above it is “my_new_location“.

Step 2 – Output the menu location in your theme

Use the wp_nav_menu function to output the menu.

Add the following to one of your theme template files (usually header.php):

Important: the “theme_location” parameter must be present, and must match the menu location ID specified in step 1. wp_nav_menu takes many parameters, but the only one required for Max Mega Menu to work is “theme_location”.

Once these steps have been taken follow the standard documentation to enable Max Mega Menu for your menu.

Troubleshooting

  • Make sure your menu location ID is identical in both your “register_nav_menu” and “wp_nav_menu” function
  • Avoid using hyphens (-) in the location ID, use underscores instead
  • Make sure the “wp_nav_menu” function call specifies the correct “theme_location” parameter
  • If you have changed the menu location ID since enabling MMM for a location, you will need to re-enable MMM for your new location ID
  • Make sure your theme follows WordPress coding standards (and correctly includes wp_head and wp_footer).

Sample Custom Theme

Download Sample Theme

The sample theme has the bare minimum code required for Max Mega Menu to work correctly. The menu location is registered in functions.php and output in index.php.

Article Attachments

Related Articles