Custom Post Type children and grand-children in one list

When i lost track with all the crappy code, i decided to start all over 🙂 And so i found the solution: <?php // Define variables $post_type=”file”; $taxonomy = ‘file-category’; $taxonomy_terms = get_terms($taxonomy); global $current_page_id; $current_page_id = get_the_ID(); // Start if if ($taxonomy_terms) { // Start Foreach foreach ($taxonomy_terms as $taxonomy_term) { // Start arguments … Read more

Need a conditional to test if title of parent page matches title of child page

solution here as function: function testchildren () { global $post; $childtest = get_pages(‘child_of=”.$post->ID); if( count( $childtest ) != 0 ) { return false; } else { return true; } } and implementation as markup: <?php if (have_posts()) : while (have_posts()) : the_post() ; ?> <h2><?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h2> <?php if ( … Read more

“Static” Child Menu with Accordian

I’ve figured this out. I think one of the examples in the WordPress Codex is supposed to be the solution but simply doesn’t work. Here is what worked for me: <?php if ($post->post_parent) { $ancestors=get_post_ancestors($post->ID); $root=count($ancestors)-1; $parent = $ancestors[$root]; } else { $parent = $post->ID; } $children = wp_list_pages(“title_li=&child_of=”. $parent .”&echo=0″); if ($children) { ?> … Read more

1st Level Page with No Children

To expand upon my comment: Top-level page? (q.1) global $post; $x = get_ancestors( $post->ID, ‘page’ ); if( ! $x ) { // there are no ancestors, therefore this is a top-level page } Childless page? (q.2) global $post; $args = array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ); $x = get_children( $args ); if( ! … Read more