簡體   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