How to remove pipe after last navigation menu item (4 posts)

  1. kubegusa
    Posted 3 years ago #

    After reading how to add '|' between the navigation menu items on my Twenty eleven child theme http://www.route32.be/demaeyer/

    here http://wordpress.org/support/topic/plugin-menus-adding-the-pipe-character-to-wp_nav_menu?replies=4

    Another question that I have is: how can I remove the '|' after the last menu item? I only want it to separate the menu items but not have one at the very last.


  2. kubegusa
    Posted 3 years ago #

    My php code looks like this:

    <?php wp_nav_menu( array( 'theme_location' => 'primary', 'link_after' => '<span class="my-span">|</span>' ) ); ?>

    I've tried all other options that I could find using CSS to define this, but I always got pipes underneath the navigation menu. Couldn't figure out how to make this work using CSS.

    In changing this php code, I'm still looking to add spaces between the menu items and the pipes, and how to remove the last pipe.

    I did quite some reading online about this, and it seems to be a tricky one for many. Please help!

  3. kubegusa
    Posted 3 years ago #

    Basically, I'm thinking.. if I can add a character using PHP, I should be able to add a space, using PHP too... but how oh how...

    that would solve my 1st problem... would still need to figure out how to remove the last pipe


  4. kubegusa
    Posted 3 years ago #

    When I add   to the PHP code
    <?php wp_nav_menu( array( 'theme_location' => 'primary', 'link_after' => '<span class="my-span">nbsp|nbsp</span>' ) ); ?>

    It again, gives me the spaces but also additional pipes below the navigation menu.
    Big sigh.

Topic Closed

This topic has been closed to new replies.

About this Topic