2014-05-16 179 views
0

我有下面的代码行:显示帖子 - WordPress的

$args = array('category_name' => the_slug(), 'post_type' => 'Feature', 'posts_per_page' => 2, 'orderby'=> rand); 

其中在展示从类两个职位,工作正常,只要类别名称相同的蛞蝓当前页面。我需要将类别名称更改为我的自定义分类,这称为'特色'。我已经尝试将category_name更改为featured_name,但它只显示了所有帖子,而不是该分类中的所有帖子。

回答

1

结束了以下内容:

$args = array(
'showposts' => -0, 
'post_type' => 'feature', 
'orderby' => rand, 
'tax_query' => array(
    array(
    'taxonomy' => 'featuring', 
    'field' => 'slug', 
    'terms' => the_slug() 
    ) 
) 
);