Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.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_Twitter Bootstrap - Fatal编程技术网

Php WordPress自定义字段图像未插入数组

Php WordPress自定义字段图像未插入数组,php,wordpress,twitter-bootstrap,Php,Wordpress,Twitter Bootstrap,我正在使用Wordpress创建一个使用引导的动态库。我创建了一个新的自定义字段,然后将其设置为“图像”,然后将其分配给我的帖子类型。然后它出现在我的帖子中,我将我的图片上传到该字段,然后尝试将所有附件放入一个数组中,然后我将通过它们循环显示 $args = array( 'post-type' => 'attachment', 'numberposts' => -1, 'post_status' => 'any', 'post_parent' => $post->

我正在使用Wordpress创建一个使用引导的动态库。我创建了一个新的自定义字段,然后将其设置为“图像”,然后将其分配给我的帖子类型。然后它出现在我的帖子中,我将我的图片上传到该字段,然后尝试将所有附件放入一个数组中,然后我将通过它们循环显示

$args = array(
'post-type' => 'attachment',
'numberposts' => -1,
'post_status' => 'any',
'post_parent' => $post->ID,
'exclude' => get_post_thumbnail_id()
);

$attachments = get_posts($args);

执行此操作并使用附件执行var转储后,它表示数组中没有任何内容

为了在帖子中显示自定义字段值,您必须在帖子显示循环中使用

您是否使用ACF将图像上载到自定义字段?如果我将此与引导carousal一起使用,我不会使用循环,还有什么方法可以实现这一点吗?我已经做到了,但不是一次使用所有图像,有没有一种方法一次只显示一个图像?