Php 按多个类别筛选Wordpress帖子
我排序后,显示一个单一的类别与此代码Php 按多个类别筛选Wordpress帖子,php,wordpress,Php,Wordpress,我排序后,显示一个单一的类别与此代码 global $post; $args = array( 'category_name'=>'oranges', 'numberposts' => -1, ); 我想显示“橙子”和“苹果”类别中的所有帖子,因此我修改了用于显示单个类别的代码: global $post; $args = array( 'category_name'=>'oranges',
global $post;
$args = array(
'category_name'=>'oranges',
'numberposts' => -1,
);
我想显示“橙子”和“苹果”类别中的所有帖子,因此我修改了用于显示单个类别的代码:
global $post;
$args = array(
'category_name'=>'oranges',
'category_name'=>'apples',
'numberposts' => -1,
);
这仅显示苹果类别中的帖子。谢谢
感谢Arsalan的建议,此处的代码仅适用于这两个类别的帖子
global $post;
$args = array(
'category_name'=>'oranges + apples',
'numberposts' => -1,
);
感谢Arsalan的建议,这里的代码仅用于两个类别的帖子
global $post;
$args = array(
'category_name'=>'oranges + apples',
'numberposts' => -1,
);
对多个类别使用(+)
global $post;
$args = array(
'category_name'=>'oranges + apples',
'numberposts' => -1,
);
对多个类别使用(+)
global $post;
$args = array(
'category_name'=>'oranges + apples',
'numberposts' => -1,
);
试试
'category\u name'=>'oranges,apples'
或'category\u name'=>'oranges+apples'
谢谢Arsalan做了这个把戏。试试'category\u name'=>'oranges,apples'
或'category\u name'=>'oranges+apples'
谢谢Arsalan做了这个把戏。