Wordpress - 按分类过滤
我的查询中发生了一些奇怪的事情,看不出出了什么问题 我从选择列表中传递变量 THEME 。 主题是从分类法主题中提取的,
所以我的代码看起来像
$thetheme = $_GET['theme'];`
$thetheme 是从 URL 正确传递的
,然后
$args2 = array(
'tax_query' => array(
array(
'taxonomy' => 'theme',
'field' => 'slug',
'terms' => $thetheme
)
),
'post_type' => array( 'post', 'dvd' ),
'cat' => '31',
'paged' => $paged,
'posts_per_page' => $listitems,
'order' => 'DESC',
'orderby' => 'date',
'query' => $wp_query
);`
查询仅适用于某些帖子,而不是所有帖子,并且无法理解为什么。 例如,如果我选择主题为“冒险”的帖子,它将提取正确数量的帖子。 但同一类别中不同主题的其他帖子将不会显示。
这让我很困惑......
帮助!
谢谢
Something weird happening in my query and can't see what's wrong
I am passing the variable THEME from a select list.
THe theme is pulled from the taxonomy THEME
so my code looks like
$thetheme = $_GET['theme'];`
$thetheme is correctly passed from URL
then
$args2 = array(
'tax_query' => array(
array(
'taxonomy' => 'theme',
'field' => 'slug',
'terms' => $thetheme
)
),
'post_type' => array( 'post', 'dvd' ),
'cat' => '31',
'paged' => $paged,
'posts_per_page' => $listitems,
'order' => 'DESC',
'orderby' => 'date',
'query' => $wp_query
);`
The query is working only on some Post, not all of them, and cant understand why.
If I select a post with the Theme "Adventure" for example, it will pull the correct amount of post.
But an other post, in the same category with a different theme, will not be displayed.
This is puzzling me....
HElP!
thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您不需要在这里运行完整的分类查询...尝试这个 =)
Don't think you need here to run complete taxonomy query... try this =)