wordpress - 每个术语分类一个帖子
问题描述
我需要一些帮助,再次。
我使用这个查询:
$tax = get_the_terms($id, 'coupon_category');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( array(
'post_type' => APP_POST_TYPE,
'post_status' => 'publish',
'posts_per_page' => 4,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'coupon_category', // Taxonomy
'field' => 'slug',
'terms' => $tax[0]->slug, // Your category slug
),
array(
'taxonomy' => APP_TAX_STORE,
'field' => 'slug',
'terms' => $term->slug,
'operator' => 'NOT IN',
),
),
) );
我知道需要一个解决方案来仅显示每个分类术语中的一个帖子APP_TAX_STORE
。从这个用户完整的论坛尝试了一些解决方案,但对我不起作用。
解决方案
推荐阅读
- php - Laravel 存储许多 GB 的缓存存储文件并且不会自动擦除旧缓存
- ios - 如何保持 iOS 应用程序的运行时一致?
- android - Android Room 查询不返回 LiveData
- javascript - 通过控制台浏览器在第一页触发按钮后在第二页操作数据
- apache-spark - HDFS 中的数据节点是否与 Spark 集群中的执行程序节点相同?
- c - 给定一些目标文件和一些 C 文件,如何设置 Makefile 来编译 C 项目
- python - Python Pygame 超慢,窗口大小增加
- sql - 使用默认值向表中添加列
- javascript - 在 JavaScript 中选择高于 2 级或更高级别的父目录
- php - 如何获取当前用户的经纬度并计算与位置 B 的距离?