【发布时间】:2011-07-04 15:35:31
【问题描述】:
我正在使用 Wordpress 3.1.4 - 并尝试使用具有特定类别的自定义帖子动态填充菜单,如您所见 here.
所以在页面上 - 我有主循环 - 列出所有玩具产品。这些产品都来自标有“产品”的自定义帖子类型 - 每个产品属于不同的类别 - 毛绒玩具、游戏等。
在侧边栏菜单中,我为每个类别编写了以下代码,以便列出给定类别中的产品:
<ul class="acitem">
<?php query_posts(array ('post_type' => 'products''cat=games')); ?>
<?php $games_query = new WP_Query("category_name=games"); ?>
<?php while ($games_query->have_posts()) : $games_query->the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</ul>
由于某种原因,没有生成列表项。这可能与页面上的主循环冲突吗?
任何建议或指针表示赞赏! -
PS - 我正在使用以下插件:
- 自定义帖子类型用户界面
- WP 页面导航
如果这有任何影响。
【问题讨论】:
标签: wordpress menu custom-post-type