WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

    <div class="nav">
        <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>

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.

share|improve this question
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


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.