WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Including sub pages for current page (4 posts)

  1. jimmyt1988
    Member
    Posted 4 years ago #

    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>
  2. jimmyt1988
    Member
    Posted 4 years ago #

    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?

  3. jimmyt1988
    Member
    Posted 4 years ago #

    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?

  4. jimmyt1988
    Member
    Posted 4 years ago #

    AHHH.. Sussed it.

    For record sake.

    wp_list_pages('title_li=before=text text text&after=text text text')

Topic Closed

This topic has been closed to new replies.

About this Topic