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 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">
    <div id="contactInfo">
</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?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.