WP Query conflict on tag and category templates
-
My WP_query in the header menu fails to pull any posts on tag and category pages only. Error occurs even with the Loop removed from those template pages.
The menu in the header lists the parents. Then for each parent, it then queries for their child posts and image. Interestingly, (ALL) the posts appear when ‘post_parent’ condition is removed from $group_nav.
I’m relatively new to php so any help is much appreciated. This issue has been giving me grief for the last 3 days!
Coding in header.php
<?php $group_nav_ids = array(916,917,918,919,920,921); //custom post type parent ids foreach ($group_nav_ids as $group_nav_id): ?> *do stuff <?php $group_nav = new WP_Query(array( //get children posts 'post_type' => 'pgroup', 'post_parent' => $group_nav_id, 'order' => 'ASC', 'orderby' => 'menu_order', 'posts_per_page' => -1 )); if ($group_nav->have_posts()) : ?> <?php while ($group_nav->have_posts()) : $group_nav->the_post(); ?> *do stuff <?php endwhile; ?> <?php endif; ?> <?php endforeach; ?> <?php wp_reset_postdata(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WP Query conflict on tag and category templates’ is closed to new replies.