WordPress.org

Forums

child_of not displaying right (1 post)

  1. jamespellerano
    Member
    Posted 5 years ago #

    The description for child_of
    "child_of
    (integer) Displays the sub-pages of a single Page only; uses the ID for a Page as the value. Note that the child_of parameter will also fetch "grandchildren" of the given ID, not just direct descendants. Defaults to 0 (displays all Pages)."

    I need it to do that.

    <?php
    if (is_front_page()) {
    wp_list_pages('title_li=&depth=1&exclude=8');
    }
    else {
    $output = wp_list_pages('echo=0&depth=1&title_li=&exclude=8');
    if (is_page()) {
    $page = $post->ID;
    if ($post->post_parent) {
    $page = $post->post_parent;
    }
    $children = wp_list_pages('echo=0&child_of='.$page .'&title_li=&exclude=8');
    if ($children) {
    $output = wp_list_pages('echo=0&child_of'.$page.'&title_li=&exclude=8');
    }
    }
    echo $output;
    }
    ?>

    I used the code from the examples and it should only display the children of the current page?

    I am displaying all of the children which looks horrible... also how do insert tags for the children so I can style them?

    website: http://www.northeastern.edu/aalearningcommunity/

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 5 years ago by jamespellerano
  • This topic is not resolved
  • WordPress version: 2.8.4