WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] wp_nav_menu delimiter / after, dont show on last item (2 posts)

  1. Darrell Schauss
    Member
    Posted 3 years ago #

    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?

  2. Darrell Schauss
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic