Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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' )); ?>
  </nav>

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
    
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
add comment

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

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

2 Answers

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
add comment

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">

or

<div class="navigation">

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

share|improve this answer
add comment

Your Answer

 
discard

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