[resolved] wp_nav_menu() Problem! (3 posts)

  1. El Comegente
    Posted 4 years ago #

    Hello wpeople!

    I'm having a little problem and i'm getting very frustrater... i hope you can help me!

    I'm developing my own template but i cant get to run the wp_nav_menu() properly. The function itself works, the problem comes -and more than one are going to laugh - when i'm trying to set the parameters of the function. I'm copying and pasting this exact code

    `<?php $defaults = array(
    'theme_location' => ,
    'menu' => ,
    'container' => 'div',
    'container_class' => 'menu-{menu slug}-container',
    'container_id' => ,
    'menu_class' => 'menu',
    'menu_id' => ,
    'echo' => true,
    'fallback_cb' => 'wp_page_menu',
    'before' => ,
    'after' => ,
    'link_before' => ,
    'link_after' => ,
    'items_wrap' => '<ul id=\"%1$s\" class=\"%2$s\">%3$s</ul>',
    'depth' => 0,
    'walker' => );

    <?php wp_nav_menu( $defaults ); ?> `

    from http://codex.wordpress.org/Function_Reference/wp_nav_menu and it gives me a syntax error... and honestly i dont see any syntax error but maybe i'm too tired.

    Hope you can help me out here!

  2. michael.mariart
    Posted 4 years ago #

    There are syntax errors in that code. Unfortunately the WP maunal doesn't have these things set u pquite right, so you can't just cut-and-paste like that.

    The problem is that you need some value for every one of the lines. You can't just leave it blank. So, when there's a line like
    'walker' => ,
    That's incorrect because there needs to be something after the =>.

    For that example, the best thing to do is add in '' (two single-quotes) after the => like:
    'walker' => ''
    This will give it a value and stop the problems. Remember that every lime must have some value otherwise you will get the invalid syntax errors.

  3. El Comegente
    Posted 4 years ago #

    oops.... thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic