Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 获取满足wordpress中两种分类法的术语_Php_Wordpress - Fatal编程技术网

Php 获取满足wordpress中两种分类法的术语

Php 获取满足wordpress中两种分类法的术语,php,wordpress,Php,Wordpress,我试图只获取满足两种自定义帖子类型分类法的术语,即我只想显示tilesize 25x33中的颜色,其中Color和tilesize是我的自定义帖子类型分类法 我尝试过使用下面的代码,但它仍然显示所有颜色,而不是tilezise 25x33 $args = array('post_type' => 'product', 'tilesizes'=>'25x33'); $colour = get_terms("colour" $args); if ( !empty( $colour ) &

我试图只获取满足两种自定义帖子类型分类法的术语,即我只想显示tilesize 25x33中的颜色,其中Color和tilesize是我的自定义帖子类型分类法

我尝试过使用下面的代码,但它仍然显示所有颜色,而不是tilezise 25x33

$args = array('post_type' => 'product', 'tilesizes'=>'25x33');
$colour = get_terms("colour" $args);
if ( !empty( $colour ) && !is_wp_error( $colour ) ){
$colourtag = '';
foreach ( $colour as $colour ) {
$colourtag .=  '<label><input type="checkbox" rel="' . $colour->name .'"/> '.$colour-  >name.' </label>';

}}

echo '<div class="refinetags">'.$colourtag.'</div>';
$args=array('post_type'=>'product','tilesizes'=>'25x33');
$color=获取术语(“color”$args);
如果(!empty($color)&&!is_wp_error($color)){
$colortag='';
foreach($color作为$color){
$colortag.=''.$color->name';
}}
回显“.$colortag.”;

请帮助我如何实现这一点

您尚未在
get\u terms()中通过
$args

您只传递了第一个参数,它是
分类法
(“color”在您的例子中)

这里第一个参数可以是数组或字符串


可能会对您有所帮助。

您在哪里使用了
$args
?@TechnoKnol谢谢,我已经更新了我的问题,我在哪里使用了$args但仍然没有运气。
$color=get_terms(“color”$args)
尝试过使用,但仍然没有幸运您忘记了两个参数之间的冒号(
),您是否阅读了我在答案中链接的文档。