Loop child pages displaying different content depending on depth
-
I’m trying to make an page-template with content from it’s childpages.
I want it to display different content depending on which level it is. Like this:
If the page is depth 1 – display xxxxx
If the page is depth 2 – display xxxxxHere’s the code I’m trying to use
<?php $this_page_id=$wp_query->post->ID; ?> <?php query_posts(array('post_parent' => $this_page_id, 'post_type' => 'page')); while (have_posts()) { the_post(); ?> <?php if ( get_post_meta($post) ) { ?> <h3>THIS IS DEPTH 1<?php the_title(); ?></h3> <?php } else { ?> <p>THIS IS DEPTH 2 - <?php the_content(); ?></p> <?php } ?> <?php } ?>
Any suggestions?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Loop child pages displaying different content depending on depth’ is closed to new replies.