Php Wordpress gallery图像URL到数组
我正试图从添加到post gallery的图像中获取wordpress上的图像URL数组,我真的不知道我在这里做错了什么,但我认为我没有从wordpress获得正确的数组,有人能帮我吗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
<?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);