Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.


Right now I'm using the <?php wp_page_menu('menu_class=nav'); ?> function, which gives this result:

    <div class="nav">
      <ul>
        <li class="page_item page-item-5"></li>
        <li class="page_item page-item-7"></li>
        <li class="page_item page-item-9"></li>
        <li class="page_item page-item-11"></li>
      </ul>
    </div>

Obviously, in every li tag there is an a tag; so my goal is to add a div tag inside the li tag and under the a tag. How can I do that? I know that I have to create a function in functions.php, but I don't know which one.
Thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The question is light on detail but I'd lean toward a custom Walker:

class My_Page_Walker extends Walker_Page {
  function end_el( &$output, $page, $depth = 0, $args = array() ) {
    $output .= '<span>After the Anchor</span></li>';
  }
}

$args = array(
  'walker' => new My_Page_Walker
);
wp_list_pages( $args ); 

That should insert content just before the closing </li> with is what I think you want.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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