WordPress.org

Forums

Template to print all subpages (5 posts)

  1. olalindberg
    Member
    Posted 3 years ago #

    I'm trying to build a template that prints all pages that are a subpage to the page that uses the template. Or actually.... I'm not really sure what I do :) Any help? Thanks!

    You can see my php code here http://pastebin.com/ZVPhuLsR

  2. randyttp
    Member
    Posted 3 years ago #

    Something like this maybe - it might help you go in the right direction.

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    specifically looking at

    $subpages = get_pages(array("child_of"=>$post->ID));

    and

    if ( ($subpages != null) && ($page->ID == $post->ID) ):
  3. olalindberg
    Member
    Posted 3 years ago #

    Thanks a lot. I think you lost some code... Can you repost using pastebin?

  4. olalindberg
    Member
    Posted 3 years ago #

    I got the subscription email where your code was included and copied it from there. I think there is enough info here to solve my issue.

    http://pastebin.com/jp22JerF

    Thanks a lot!

  5. olalindberg
    Member
    Posted 3 years ago #

    Here is how I did. Seems to work fine. Thanks again!

    http://pastebin.com/CXJiqWAz

Topic Closed

This topic has been closed to new replies.

About this Topic