Support » Fixing WordPress » Including sub pages for current page

  • Resolved jimmyt1988

    (@jimmyt1988)


    Hi all,

    I have been struggling for 45 mins trying to get this right.

    On my index page I have a side div that will list sub pages (child pages) of the current page (the parent page).

    Unfortunately I have no idea how to do that.
    I also will need to wrap some divs around each li.

    <div id = "leftLinks">
    
      <div class = "wrapButton">
        <div class = "top"></div>
        <div class = "middle">
          <ul><li><a href = "">SUB LINK GOES HERE</a></li></ul>
        </div>
        <div class = "bottom"></div>
      </div>
    
      <div class = "wrapButton">
        <div class = "top"></div>
        <div class = "middle">
          <ul><li><a href = "">SUB LINK GOES HERE</a></li></ul>
        </div>
        <div class = "bottom"></div>
      </div>
    
    </div>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Fortunately, I finally found this:

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
        <?php echo $children; ?>
      <?php } ?>

    Unfortunately I now need to wrap my extra div parts around each link?

    How do I go about doing this?

    Now I have:

    <?php
    $children = wp_list_pages('title_li=$before=<div class = "wrapButton"><div class = "top"></div><div class = "middle">&child_of='.$post->ID.'&echo=0'.'$after=</div><div class = "bottom"></div></div>');
      if ($children) {
        echo $children;
      }
    ?>

    But it only prints out the code that is in $before. It just skips off $after?

    AHHH.. Sussed it.

    For record sake.

    wp_list_pages(‘title_li=before=text text text&after=text text text’)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Including sub pages for current page’ is closed to new replies.