Add link to parent page in list of child pages

you would add something like //* List child pages [jla_childpages] function jla_list_child_pages() { global $post; $parentID = ( is_page() && $post->post_parent ) ? $post->post_parent : $post->ID; $parentPost = get_post($parentID); $isParentCurrent = (get_the_ID() == $parentID) ? ” current_page_item” : ”; $parent = “<li class=”page_item page-item-{$parentID}{$isParentCurrent}”><a href=””.get_permalink( $parentID ).””>{$parentPost->post_title}</a></li>”; $childpages = wp_list_pages( “sort_column=menu_order&title_li=&child_of={$parentID}&echo=0” ); if ( $childpages … Read more

Child pages and sub-pages do not appear. Why?

You need to check if the page have parent to display the child page template or if he doesnt have to display the parent page template. If $post->post_parent is equal to 0 thats mean that he doesnt have a parent. while ( have_posts() ) : the_post(); $template = ($post->post_parent == 0) ? ‘page’ : ‘child-page’; … Read more

How to disable alphabetical sorting page

If you look at get_pages() in the Code Reference you’ll notice two parameters: sort_order and sort_column. So, the following example will give you child pages list sorted by menu_order: $pages = get_pages( array( ‘child_of’ => $post->ID, ‘post_type’ => ‘page’, ‘post_status’ => ‘publish’, ‘sort_column’ => ‘menu_order’, ‘sort_order’ => ‘desc’, ) ); You can change menu order … Read more

Create a list of pages excluding children of selected page

//Create an array containing the IDs of pages that are children of page ID XXX $args = array( ‘post_type’ => ‘page’, ‘post_parent’ => XXX, ‘fields’ => ‘ids’, ‘posts_per_page’ => -1, ); $qry = new WP_Query($args); //Convert the array into a string $string = implode(‘, ‘, $qry->posts); //Display the list of IDs – for testing purposes. … Read more