1

由于我设置模板的方式,我需要以字符串 url 格式包含以下内容:

$the_query = array( 'post_type' => 'product', 'taxonomy' => 'product_types', 'term' => 'solar-panel' )

我想像

$the_query = new WP_Query( 'post_type=product&taxonomy=product_types&term=solar-panel&showposts=2' )

但这不起作用,因为分类法本身就是一个数组。谢谢。

4

1 回答 1

0

您的模板是否允许您在 WP_Query 之外设置选项?

$args=array(
  'post_type' => 'product',
  'taxonomy' => 'product_types',
  'term' => 'solar-panel',
);

$the_query = new WP_Query($args);

如果没有,您的模板不允许您这样做怎么办?你能发布一些代码吗?

于 2012-07-12T20:05:58.853 回答