WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Twentyeleven Child: How to remove last pipe character from nav menu (5 posts)

  1. kubegusa
    Member
    Posted 1 year ago #

    I have a Twentyeleven child theme
    http://www.sparklynx.be/preview/demaeyer/

    I added code to the header.php to add the pipe character '|' between the nav menu items

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

    And I added this CSS code to style it

    .my-span{
    	float:right;
    	margin-left: 0.5em; /*adds space left btw navi menu items*/
    	margin-right: 0.5em; /*adds space right btw navi menu items*/
    	color: white; /*make white pipe*/
    	}

    But how do I remove the last pipe character from the nav menu?
    I tried the solutions offered on this forum and elsewhere, but nothing worked for me.

    Any ideas?

  2. Eric Hoanshelt
    Member
    Posted 1 year ago #

    Try this CSS:

    .menu-item-17 .my-span {
        display: none;
    }

    When you add more to the menu, you will need to edit the menu-item number but for now, that CSS should work.

  3. kubegusa
    Member
    Posted 1 year ago #

    Oh my god, you're a star! I spent HOURS looking to fix this. Thanks so much!

  4. Eric Hoanshelt
    Member
    Posted 1 year ago #

    No problem!

  5. kubegusa
    Member
    Posted 1 year ago #

    somehow this solution doesn't work anymore for another project... I've been trying to understand your code but it's not clear to me where you get the 17 from and how it defines what it does (hope that makes sense)
    so troubleshooting is not a success so far

    http://www.sparklynx.be/preview/bric_consult/

    any pointers would be greatly appreciated

    I also wonder if it makes more sense that I start learning to make a theme from scratch rather than working with child themes every time.. twentyeleven feels very complicated and elaborate

Topic Closed

This topic has been closed to new replies.

About this Topic