简体   繁体   English

如何在自定义分类法中查询自定义帖子类型的帖子? 在wordpress 3.0中

[英]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.

相关问题 将WordPress帖子和相关分类法移动到自定义帖子类型和分类法 - Move WordPress posts and related taxonomy to custom post type & taxonomy WordPress按自定义分类显示自定义帖子类型的帖子 - WordPress displaying custom post type posts by custom taxonomy 在自定义帖子类型分类法WordPress中显示y个帖子中的x个 - Showing x of y posts in custom post type taxonomy WordPress 计算自定义帖子类型分类法 (WordPress) 中的帖子数量 - Count number of posts in a custom post type taxonomy (WordPress) WordPress。 SQL 查询以获取分类中的自定义 post_type 帖子计数。php 模板 - WordPress. SQL Query to get custom post_type posts counts in taxonomy.php template WordPress自定义帖子类型和分类 - WordPress Custom Post Type and Taxonomy WordPress自定义帖子类型分类 - WordPress Custom Post Type taxonomy 通过自定义分类法类型迭代自定义帖子类型? (按类别订购wordpress帖子,或按分类学术语显示自定义帖子类型) - Iterate through custom post type by custom taxonomy type? (Ordering wordpress posts by category, or displaying custom post type by taxonomy term) Wordpress,带自定义分类和自定义帖子类型的WP_Query - Wordpress, WP_Query with custom taxonomy and custom post type WordPress 3.0.1使用自定义分类法查询自定义帖子类型 - WordPress 3.0.1 Query Custom Post Type with Custom Taxonomy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM