开发者

Creating custom wordpress function not working

开发者 https://www.devze.com 2023-01-24 19:20 出处:网络
Im trying to add a little code to an already made thumbnail plugin. Basically i want to get the image src of an image and the just print it into the HTML开发者_JAVA技巧, but everytime i run it, its j

Im trying to add a little code to an already made thumbnail plugin.

Basically i want to get the image src of an image and the just print it into the HTML开发者_JAVA技巧, but everytime i run it, its just echoing 'Array'

This is what i have so far.

$testing = wp_get_attachment_image_src($post_thumbnail_id);
$html = '<a href="'.$testing.'">';

Any help would be greatly appreciated.


According to the Wordpress Documentation for wp_get_attachment_image_src the return value is:

An array containing:
$image[0] => url
$image[1] => width
$image[2] => height

Therefore, this is what you need:

$html = '<a href="'.$testing[0].'">';
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号