Most wp_nav_menu parameters ignored

I'm trying to get a text-based navigation menu for the footer of my site. I'm using the wp_nav_menu() parameters as directed by Codex. He're a snippet of code (in footer.php):

div id="footer"
    ?php wp_nav_menu(array('depth'=1, 'after'='span class="sep"|/span')); ?br /
    div id="address"
        p.../p
    /div
    div id="contactInfo"
        p.../p
        p.../p
    /div
/div!-- #footer --

So, my goal is to make the menu look like Home | About | MorePages with only the root-level pages included.

The problem:

The after parameter is ignored! If I try before and items_wrap, along with other parameters, they are also ignored. I've been able to get after_link and before_link to work, as well as depth.

I've tried escaping things and not passing HTML, but neither helps.

I'm building based on the Sandbox theme, but nav-menu-template.php and nav-menu.php appear unchanged from the WP core.

How can I get these custom parameters to work?

Topic sandbox navigation core customization themes Wordpress

Category Web


The reason for your not being able to use before and after is because when you're calling wp_nav_menu() with a default fallback of wp_page_menu(), which does not have a before and after arguments.

Refer to line 171: http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/nav-menu-template.php#L137

Apparently the menu you are trying to get does not exist (has no items) the !$menu is true. Make sure you have created a menu in Appearance > Menus and set it to a default one, or query for an existing one, or customize the fallback function, otherwise wp_page_menu will be called, simply listing all the pages.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.