开发者

Wordpress - Filter by Taxonomy

Something weird happening in my query and can't see what's wrong I am passing the variable THEME from a select list. THe theme is pulled from the taxonomy THEME

so my code looks like

$thetheme = $_GET['theme'];`

$thetheme is correctly passed from URL

then

$args2 = array(
     'tax_query' => array(
     array(
         'taxonomy' => 'theme',
         'field' => 'slug',
         'terms' => $thetheme
         )
     ),
     'post_type' =&g开发者_如何转开发t; array( 'post', 'dvd' ), 
     'cat' => '31',
     'paged' => $paged, 
     'posts_per_page' => $listitems,
     'order' => 'DESC',
     'orderby' => 'date', 
     'query' => $wp_query
);`

The query is working only on some Post, not all of them, and cant understand why. If I select a post with the Theme "Adventure" for example, it will pull the correct amount of post. But an other post, in the same category with a different theme, will not be displayed.

This is puzzling me....

HElP!

thx


Don't think you need here to run complete taxonomy query... try this =)

 $args2 = array(
      'theme' => $thetheme,
      'post_type' => array( 'post', 'dvd' ), 
      'cat' => '31',
      'paged' => $paged, 
      'posts_per_page' => $listitems,
      'order' => 'DESC',
      'orderby' => 'date', 
      'query' => $wp_query
 );
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜