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!
drop-down menu canbe viewed here: http://d1079691-5522.myweb.westnethosting.com.au/wsp-ie.com.au/?industry=construction
and mis-behaving here: http://d1079691-5522.myweb.westnethosting.com.au/wsp-ie.com.au/?tag=synthetic-leather
Coding in header.php
<?php $temp_query = clone $wp_query; ?> <?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_query(); wp_reset_postdata(); rewind_posts(); ?> <?php $wp_query = clone $temp_query; ?>