I creating a custom footer navigation in wordpress. I looked all over the wordpress documentation and still haven't found anything. So, what I'm trying to do is add an "|" in the navigation like this:

Home | Link 1 | Link 2 | Link 3 | Contact

I know there's a way in CSS, but I know this is generated by wordpress so I'm a little stumped on how to do this.

  • 1
    Are you using wp_nav_menu? Could you please post the code used to display the nav menu? – Jared Feb 24 '12 at 16:12

wp_nav_menu has a $beforeand $after parameters which you can use to add your pipes with.

read more about wp_nav_menu entry at the codex


I figured out a way to do this and without using the wp_nav_menu.

Here's the code to do this and hope it might help other (Note: You need to create a menu in the admin panel to have this work).

                    $items = wp_get_nav_menu_items("footer");
                        $count = count($items);
                        $i = 0;
                    foreach($items as $item):
                        $i += 1;
                <a href="<?php echo $item->url; ?>"><?php echo $item->title; ?></a><?php if($i < $count){ echo "<span class='center'>|</span>";} ?>
                <?php endforeach; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.