Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/243.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 创建自定义wordpress函数不起作用_Php_Wordpress - Fatal编程技术网

Php 创建自定义wordpress函数不起作用

Php 创建自定义wordpress函数不起作用,php,wordpress,Php,Wordpress,我想给一个已经制作好的缩略图插件添加一点代码 基本上我想得到一个图像的图像src,然后把它打印到HTML中,但是每次我运行它时,它都会回显“Array” 这就是我目前所拥有的 $testing = wp_get_attachment_image_src($post_thumbnail_id); $html = '<a href="'.$testing.'">'; 非常感谢您的帮助。根据Wordpress文档,返回值为: An array containing: $image[0]

我想给一个已经制作好的缩略图插件添加一点代码

基本上我想得到一个图像的图像src,然后把它打印到HTML中,但是每次我运行它时,它都会回显“Array”

这就是我目前所拥有的

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

非常感谢您的帮助。

根据Wordpress文档,返回值为:

An array containing: $image[0] => url $image[1] => width $image[2] => height 因此,这就是您需要的:

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