Exclude child pages args array

There is not depth parameter for get_posts. See http://codex.wordpress.org/Template_Tags/get_posts You will need to check to see whether the page has a parent and display it if it does not have a parent. Once you are in the foreach loop add an if statement <?php if( !$post->parent ): ?> <li><a href=”https://wordpress.stackexchange.com/questions/26866/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”> … Read more

Check if page has subpages

You have to pass the parent page id to the wp_list_pages function instead of the global $post->ID in your subpages. function wpse33151_getSubpages() { global $post; $parents = get_post_ancestors($post->post_id); krsort($parents); $parents = array_merge(array(), $parents); if (is_home() || is_single()) { $id = get_option(‘page_for_posts’); $parent = get_post_ancestors($id); $id = $parent[0]; } elseif($parents) { $id = $parents[0]; } else … Read more

How to control display of page lists on sidebar that doesn’t have childrens

I would try replacing your $children definition, using get_page_children() or get_children(): <?php global $post; $children = get_children( array( ‘post_type’ => ‘page’, ‘post_parent’ => $post->ID, ‘post_status’ => ‘publish’ ) ); if ( $children ) { // Code to list child pages goes here } ?> Also, wp_list_pages() will always return a string (either populated or empty), … Read more

Get list of all Grandchild Pages

My current idea is: Use get_pages to get all of the descendants of TOP and put the IDs in an array arrayAll. Then run get_pages again with parent=1 to get just the direct children of TOP. Put these in array arrayChildren. Run in php arrayGrandchildren = array_diff(arrayAll, arrayChildren) to get a list of all pages … Read more

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