0
我想顯示所有附加到wordpress文章的圖像,並將圖像鏈接到圖像來源以在光盒中打開它。我正在使用以下代碼:獲取Wordpress附件圖片網址
<?php if (have_posts()) : while (have_posts()) : the_post();
$args = array(
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
'exclude' => get_post_thumbnail_id()
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo '<div id="image"> <a rel="lightbox" href="';
???
echo '">';
echo wp_get_attachment_image($attachment->ID, 'full');
echo '</a></div>';
}
}
endwhile; endif; ?>
我已經嘗試了很多事情,但我似乎無法檢索只是源網址。
任何人都可以提供一些見解?