I am trying to add a special character to display a » alongside each menu item in Wordpress.

So for example

About us » Contact us » And so on...

Here's my code

      <li><?php echo $children; echo '»'; ?></li>

I expected this would do the job, but it just puts the » below the list.

Here's the full code

      if($post->post_parent) {
      $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      $titlenamer = get_the_title($post->post_parent);

      else {
      $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      $titlenamer = get_the_title($post->ID);
      if ($children) { ?>

      <h2 class="left_title">
        <?php echo $titlenamer ?>
      <ul class="left_body">

        <li><?php echo $children; echo '»'; ?></li>


1 Answer 1


You can do this in three ways:

1) Use before and after arguments in wp_nav_menu

2) Write a custom walker

3) Use CSS :before or :after pseudo classes to add the character. The character must be in escaped unicode, e.g.:

li:after {
 content: '\00BB';
 padding-right: 5px;

There is more in a similar StackExchange answer


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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