Support » Fixing WordPress » Custom List Pages Argument

  • Resolved mitchrenton

    (@mitchrenton)


    Hi Guys, I wonder if anybody can help me out here…

    I want to display the sub pages of the given page. Then if I am on a subpage, I want to display the other pages on that level beneath the page parent. Here’s the code I have so far…

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } else; { ?>
      //need an argument here to say display pages on the same level as current page
    
      <?php } ?>

    Hopefully that make sense, I’ve tried a few methods but just can’t seem to get both arguments firing correctly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Shane G

    (@shane-g)

    mitchrenton

    (@mitchrenton)

    Thanks for that, are you suggesting I use 2 different page templates?

    I’m really trying to keep this as lightweight as possible and would much prefer to use one template.

    Any other suggestions?

    mitchrenton

    (@mitchrenton)

    I don’t think I explained myself well enough in my original post. My page hierarchy is like this…

    About -> James
    Tim
    David

    So If I am on the about page I want to display, James, Tim and David. If I am on either the James, Tim or David page still want to display the same pages (James, Tim, David).

    Just wondered if I am on the right track with this code…

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } else; { ?>
      //need an argument here to say display pages on the same level as current page
    
      <?php } ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom List Pages Argument’ is closed to new replies.