Separator for custom nav menu

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

Read More

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.

Related posts

Leave a Reply

2 comments

  1. 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).

                <p>
                    <?php
                        $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; ?>
                </p>