[英]How to query posts for a custom post type in a custom taxonomy ? in wordpress 3.0
I've been looking everywhere, I'm trying to query to find the custom posts which are in this post type with a particular taxonomy value set. 我到处都在寻找,我试图查询以查找具有特定分类法值集的此类类型的自定义帖子。
register_post_type('toy',$args);
register_taxonomy( 'age_group', 'toy', array( 'query_var' => true, 'hierarchical' => true, 'label' => __('Age Group') ) );
How can I do this? 我怎样才能做到这一点?
I tried this, but it didn't work. 我试过了,但是没有用。
$recent = new WP_Query("age_group=test&post_type=toy&showposts=5");
I woke up this morning and tried it again. 我今天早上醒来,然后再次尝试。 It works, why? 可行,为什么? ... nevermind. ... 没关系。 Maybe working too late into the night. 也许工作到深夜。
$recent = new WP_Query("age_group=test&post_type=toy");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.