繁体   English   中英

WordPress的画廊图像URL数组

[英]Wordpress gallery image urls to array

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM