我正试图从添加到帖子库的图像中获取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)