WordPress.org

Support

Support » Themes and Templates » Display Children only.

Display Children only.

  • I am using the following code to display the child of my parent pages, but it is also displaying the children of the child pages (not sure if there is an exact term for that, lol)

    <?php
                        $subnav_parent = ($post->post_parent) ? $post->post_parent : $post->ID;
                        $pages = get_pages('child_of=' . $subnav_parent . '&sort_column=menu_order');
                        $count = 0;
                        foreach($pages as $page)
                        { ?>
    
                        <ul>
                            <li>
                            <h5 class="del_subnav">
                                <a href="<?php echo get_page_link($page->ID)  ?>" ><?php echo  $page->post_title ?></a>
                            </h5>
                            </li>
                            </ul>
                        <?php
                        }
                        ?>
                        </div>

    So is there a way to just display the children of the parent?

    Thanks
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display Children only.’ is closed to new replies.