简体   繁体   中英

split the navigation menu by the “ | ” in wordpress

Is there a simple way to split my navigation menu by the ' | ' for example ?
This is my menu :

(home  about us  our work   connect us) 

So I need like this one :

(home   |   about us   |   our work   |   connect us)

and when the editor add a new item in ( Appearance->Menus ) it must add the ' | ' automatically . Any idea ? php html css javascript ... no problem

You can do something like this to add line and check the

Fiddle

Here is simple code

<div class="verticalLine">

home  

</div>

CSS

.verticalLine {
    border-left: 2px solid ;
    display:inline;
    padding-left:5px ;
}

Hope this is what you are looking for.Just a newbie trying to help:)

try this

<?php wp_nav_menu(array('after' => '|')); ?>

For style

   .main-nav li 
    {
    list-style-type: none;
    display:inline;
    border-left:1px solid #000000;
    }

  .main-nav li:first-child
   {
        border-left: 0;

   }

I did this to my site using jquery.

 $('ul#mainNav > li').not('ul#mainNav > li:last').append("&nbsp;|&nbsp;");

You would need to update the selector to match your own navigation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM