标题菜单中的我的WP\\u查询无法仅在标记和类别页面上获取任何帖子。即使从这些模板页中删除了循环,也会发生错误。
标题中的菜单列出了父级。然后,对于每个家长,它会查询他们的子帖子和图片。有趣的是,当从$group\\U nav中删除“post\\U parent”条件时,(所有)post都会出现。
我对php比较陌生,所以非常感谢您的帮助。在过去的三天里,这个问题一直让我很难过!
可在此处查看下拉菜单:http://d1079691-5522.myweb.westnethosting.com.au/wsp-ie.com.au/?industry=construction
以及在这里的不当行为:http://d1079691-5522.myweb.westnethosting.com.au/wsp-ie.com.au/?tag=synthetic-leather
标题中的编码。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; ?>