WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to wordpress and tried to Google and looked up codex but it didn't help. I downloaded a free theme from Github and I'm trying to learn how to make a theme by looking at its code. In the header.php I found this piece

<nav class="mainnav" role="navigation">
    <?php wp_nav_menu( array('menu' => 'Main Menu', 'container' => 'false' )); ?>

I couldn't get this part " array('menu' => 'Main Menu', 'container' => 'false' ));" Also I couldn't find the navigation markup anywhere in the theme.

share|improve this question

migrated from stackoverflow.com Dec 28 '11 at 12:30

This question came from our site for professional and enthusiast programmers.

Could you tell us, what exactly you didn't understand? codex.wordpress.org/Function_Reference/wp_nav_menu Displays a navigation menu created in the Appearance → Menus panel. – Sn0opy Dec 28 '11 at 7:37
I have the theme in HTML and I want to convert its navigation in Wordpress. Where do I define the elements of the navigation ? Also what if 'container' => true ? – Bassam Ismail Dec 28 '11 at 7:44
From codex: $container (string) (optional) Whether to wrap the ul, and what to wrap it with. Allowed tags are div and nav. Use false for no container e.g. container => false Default: div – Sn0opy Dec 28 '11 at 7:46
Thanks @Sn0opy, but where do I define the markup of different elements ? – Bassam Ismail Dec 28 '11 at 7:52
Does this help anyway? wordpress.org/support/topic/customized-wp_nav_menu Otherwise I can't help you that much. Long time ago I worked with Wordpress. – Sn0opy Dec 28 '11 at 7:57

wp_nav_menu() is a template tag - that is function designed to be called in theme template file to output something.

This specific function generates and displays output of navigation menu.

Arguments, you are asking about, determine that menu displayed should be looked up by "Main Menu" name and output should not be wrapped in div container, used by default. There are plenty more possible arguments, see its documentation in Codex.

Internally this function also uses Walker-based class to generate output, but that gets into advanced stuff and may or may not be relevant to want you want to accomplish.

share|improve this answer

The 'container' => 'false' code indicates that the menu will not be surrounded by a class. Try setting it to 'true' and see what name the gets. It should be:

<div class="menu">


<div class="navigation">

Feel free to style them using your style.css file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.