WP_Query breaking conditional children list
-
Hey There!
I’ve been roaming the forums for a few hours now trying to dig out an answer but I can’t seem to find one. I have a page template querying a certain category of posts (under the page’s contents) and it is breaking my sidebar children navigation.
I’ve read on the forums that I should be using WP_Query but this still breaks the conditional element in the children/parent sidebar nav.
Here’s the query code that I’m using:
<?php $otherPosts = new WP_Query(); $otherPosts->query('cat=3'); while($otherPosts->have_posts()) : $otherPosts->the_post(); ?> <h3><?php the_title(); ?></h3> <?php the_content();?> <?php endwhile; ?>
and here is the sidebar code that is getting broken:
<?php if($post->post_parent) $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul class="children"> <?php echo '<h3>Pages</h3>' ?> <?php echo $children; ?> </ul> <?php } ?>
I’ve also tried the query reset code but that doesn’t help – if anyone has any pointers I’d be so grateful!
Thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WP_Query breaking conditional children list’ is closed to new replies.