0
votes

I have the following line of code:

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

Which works fine in showing two posts from the category, as long as the category name is the same as the slug of the current page. I need to change category name to my custom taxonomy, this is called 'featuring'. I've tried changing category_name to featuring_name but it just showed all posts instead of only ones from that taxonomy.

1

1 Answers

1
votes

Ended up with the following:

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