List child pages, exclude the current page

Looks like a syntax error to me. Try: wp_list_pages(“title_li=&child_of=2143&exclude=$current_post_id”) OR wp_list_pages(“title_li=&child_of=2143&exclude=”.$current_post_id) Also I will suggest to pass parameters as array instead of a string, for better debugging. wp_list_pages( array( ‘child_of’ => 2143, ‘exclude’ => array( $current_post_id ), ); Make sure $current_post_id is giving proper value.

Display child pages full template including the content

I would try setting up post data in the loop and then calling a page template using get_template_part function. Note: depending on theme it may produce some unexpected results, as page template sometimes also includes site header and footer. But it’s something to get you started. $getchilds = array( ‘parent’ => $post->ID, ‘child_of’ => $post->ID, … Read more

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

Get first level children of a page ID

As per the get_pages() documentation: ‘child_of’ (int) Page ID to return child and grandchild pages of. ‘parent’ (int) Page ID to return direct children of. Default -1, or no restriction. So to get immediate children of a specific page, you would use the parent arg and not child_of. $pages = get_pages( array( ‘parent’ => $pageID, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)