• I have this code right above my h2 in page.php

    <?php

    $args = array(
    ‘child_of’ => get_top_ancestor_id(),
    ‘title_li’ => ”
    );
    ?>

    <?php wp_list_pages($args); ?>

    and this code in functions.php

    function get_top_ancestor_id() {

    global $post;

    if($post->post_parent) {
    $ancestors = array_reverse(get_post_ancestors(post->ID));
    return $ancestors[0];
    }

    return $post->ID;
    }

    Can someone please tell me if there’s anything wrong with the code? I can’t find anything.

  • The topic ‘Child page codes are making my pages disappear’ is closed to new replies.