【发布时间】:2015-03-23 16:17:43
【问题描述】:
我正在尝试创建一组 WP 页面,其中包含所有具有标签 X 和类别 Y 的帖子的索引。
我发现 this 似乎完全符合我的要求,并且我了解如何为每个索引页面编辑它,但我不知道在哪里/如何使用实际代码来创建索引页面。
global $wp_query;
$args = array(
'category__and' => 'category',
'tag__in' => 'post_tag', //must use tag id for this field
'posts_per_page' => -1); //get all posts
$posts = get_posts($args);
foreach ($posts as $post) :
//do stuff
endforeach;
TIA 为您提供帮助。
【问题讨论】:
标签: wordpress tags categories