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 gallery图像URL到数组_Php_Wordpress_Image_Slider - Fatal编程技术网

Php Wordpress gallery图像URL到数组

Php Wordpress gallery图像URL到数组,php,wordpress,image,slider,Php,Wordpress,Image,Slider,我正试图从添加到post gallery的图像中获取wordpress上的图像URL数组,我真的不知道我在这里做错了什么,但我认为我没有从wordpress获得正确的数组,有人能帮我吗 <?php if(have_posts()) : while(have_posts()) : the_post(); $gallery = get_post_gallery_images(the_post()); $i = 0; foreach($gallery as $image) { e

我正试图从添加到post gallery的图像中获取wordpress上的图像URL数组,我真的不知道我在这里做错了什么,但我认为我没有从wordpress获得正确的数组,有人能帮我吗

<?php  
if(have_posts()) : while(have_posts()) : the_post();

$gallery = get_post_gallery_images(the_post()); 
$i = 0;
foreach($gallery as $image)
{
    echo('<div>');
    echo('<img u="image" src="'.$image.'" alt="'.the_title().$i.'" title="'.the_title().$i.'"/>');
    echo('<img u="thumb" src="'.$image.'" alt="'.the_title().$i.'" title="'.the_title().$i.'"/>');
    echo('</div>');
    $i++;
 }
endwhile; endif; ?>
?>

?>
尝试在$gallery中使用“$post->ID”而不是“the_post”,如下所示:

$gallery = get_post_gallery_images( $post->ID ); $gallery=get\u post\u gallery\u图像($post->ID);