LiamB
LiamB

Reputation: 18586

Wordpress Widget Show Pages within Pages

I'm looking for a wordpress widget (Or code snippet) that when displayed on a page will display all sub pages.

Example

Page Set 1
 --- Page 1
 --- Page 2
Page Set 2
 --- Page 3

So if it was places on Page Set 1 it would only display Page 1 and 2

Any suggestions?

Upvotes: 0

Views: 239

Answers (2)

dooley
dooley

Reputation: 26

If I understand your query correctly, you don't need a plugin. Try pasting this into the sidebar.php file of your theme just after your opening <ul> tag.

<?php // subpage support
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=1');
      if ($children) { ?>
      <li>
      <h2>More</h2>
      <ul>
      <?php echo $children; ?>
      </ul>
      </li>
<? } ?>

If you haven't already, you might like to create a child theme to protect your changes from future upgrades.

Upvotes: 1

dragly
dragly

Reputation: 1475

Basically you want to have a list of all the subpages on all pages where you include some meta-code?

If so, the List Subpages Plugin for Wordpress might be what you are looking for. It did the trick for me.

Upvotes: 0

Related Questions