首页 > 解决方案 > 每个术语分类一个帖子

问题描述

我需要一些帮助,再次。

我使用这个查询:

$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。从这个用户完整的论坛尝试了一些解决方案,但对我不起作用。

标签: wordpresstaxonomy

解决方案


推荐阅读