Sometimes it happens that working with WordPress, we need to get children off current page. There is a fairly simple decision to do this. We can use the WordPress function get_pages (). Here is the code example of how this can be done.
1 2 3 4 5 6 7 8 9 | <? $pages = get_pages( 'child_of=' . $post ->ID. '&sort_column=post_title' ); ?> <ul><? foreach ( $pages as $page ) { ?> <li class = "page_item" ><a href= "<?php echo get_page_link($page->ID) ?>" ><?php echo $page ->post_title ?></a></li> <?php } ?></ul> |
In this example we get page title and page link.
Thank you for posting this post. It is really helpful for me.