我在首页的头部插入了一些引导导航选项卡,其中任何选项卡都用于指定类别的帖子。如何单击此选项卡之一以及我想要的某个类别的帖子,显示在该选项卡上。
您必须
添加循环过滤器并在每个选项卡上专门查询类别。
<?php global $query_string; // required
$posts = query_posts($query_string.'&cat=12'); // only show posts from category with the ID 12 ?>
<?php // YOUR USUAL LOOP HERE ?>
<?php wp_reset_query(); // reset the query ?>
您还可以排除类别
<?php global $query_string; // required
$posts = query_posts($query_string.'&cat=-12'); // Show al posts that are NOT in category with ID 12 ?>
<?php // YOUR USUAL LOOP HERE ?>
<?php wp_reset_query(); // reset the query ?>
这是 wordpress 文档 http://codex.wordpress.org/Template_Tags/query_posts 看看"组合参数"
这里已经回答了所有问题:仅在wordpress循环中显示特定类别?