如何获得src链接到图像?(wordpress)

如何获得src链接到图像?(wordpress),wordpress,image,src,Wordpress,Image,Src,我想得到图片的src链接,但我得到的不是附件页面的链接 我在functions.php文件中使用以下代码: function show_all_thumbs() { global $post; $post = get_post($post); /* image code */ $images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&ord

我想得到图片的src链接,但我得到的不是附件页面的链接

我在functions.php文件中使用以下代码:

function show_all_thumbs() {
    global $post;
    $post = get_post($post);

/* image code */
$images =& get_children( 'post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent='.$post->ID); 
if($images){
foreach( $images as $imageID => $imagePost ){

unset($the_b_img);
$the_b_img = wp_get_attachment_image($imageID, 'thumbnail', false);
$thumblist .= '<a target="_blank" href="'.get_attachment_link($imageID).'">'.$the_b_img.'</a>';

}
}
return $thumblist;
}
函数show_all_thumbs(){
全球$员额;
$post=获取邮政($post);
/*图像编码*/
$images=&get_子项('post_type=attachment&post_mime_type=image&output=ARRAY\N&orderby=menu\order&order=ASC&post\u parent='。$post->ID);
如果($images){
foreach($imageID=>$imagePost形式的图像){
unset(_b_img);
$the_b_img=wp_get_attachment_image($imageID,'thumboil',false);
$thumblist.='';
}
}
返回$thumblist;
}
因此,如何更改此行以获取图像的src链接:

<a target="_blank" href="'.get_attachment_link($imageID).'">

感谢您的帮助。

返回一个数组,其中第一项包含src:

$src = wp_get_attachment_image_src( $imageID, 'thumbnail', false );
用法:

<a target="_blank" href="' . $src[0] . '">