Support » Fixing WordPress » wp_nav_menu delimiter / after, dont show on last item

  • Resolved Darrell Schauss

    (@dralezero)


    I am using 'after' => '|' and some left/right margin on the link element to have my horizontal menu links separated by |. How do I not show the ‘after’ on the last menu item?

Viewing 1 replies (of 1 total)
  • I found a way with jQuery. As shown, if you have multiple menus, it will only remove the | on the very last menu item of all the page. There is probably a way to fix that.
    For now, I am selecting each menu div, which wont change in my template, with "#menu-id li:last" instead.

    $j(".menu-item:last").html($j(".menu-item:last").html().replace("</a>|","</a>"));
Viewing 1 replies (of 1 total)
  • The topic ‘wp_nav_menu delimiter / after, dont show on last item’ is closed to new replies.