我已经上传了一堆图片到帖子中,并在媒体上传器中为每个图片设置了“自定义url”。
如何将分配给每个图像的自定义URL检索到底部的$caption\\u text=中?
$images =& get_children( array(
\'post_parent\' => $featured_page,
\'post_status\' => \'inherit\',
\'post_type\' => \'attachment\',
\'post_mime_type\' => \'image\',
\'order\' => \'ASC\',
\'numberposts\' => $thelimit,
\'orderby\' => \'menu_order\' )
);
// Loop through the images
foreach ( $images as $id => $image ) {
$attatchmentID = $image->ID;
$imagearray = wp_get_attachment_image_src( $attatchmentID , \'fullsize\', false);
$imageURI = $imagearray[0];
$imageID = get_post($attatchmentID);
$thumb_imagearray = wp_get_attachment_image_src( $attatchmentID , \'fullscreen-thumbnails\', false);
$thumb_imageURI = $thumb_imagearray[0];
$imageTitle = $image->post_title;
$imageDesc = $image->post_content;
$postlink = get_permalink($image->post_parent);
// If linking is On
if ($featured_linked == 1 || $featured_linked == true) {
$attatchmentURL = get_attachment_link($image->ID);
}
// Count
$count++;
if ($count>1) { echo ","; }
$slideshow_title="";
$slideshow_caption="";
//Find and replace all new lines to BR tags
$find = array("\\r\\n", "\\n", "\\r");
$replace = \'<br />\';
$imageDesc = str_replace($find, $replace , $imageDesc);
$image_post_link = get_permalink();
if ($imageTitle) $slideshow_title=\'<div class="slideshow_title">\'. esc_attr($imageTitle) .\'</div>\';
if ($imageDesc) $slideshow_caption=\'<div class="slideshow_caption">\'. $imageDesc .\'</div>\';
$caption_text= \'<div class="slideshow_captionwrap">\' . $slideshow_title . $slideshow_caption . \'> <a class="slideshow_cap_link" href="\' . $image_post_link . \'">Preview Article</a></div>\';
echo "{image : \'".$imageURI."\', title : \'". $caption_text . "\', thumb : \'".$thumb_imageURI."\', url : \'\'}";
}