我有一个快捷代码,当您使用其中的图像url时,它会显示图像。
function image_code($atts, $content = null) {
return \'<img src="\'.$content.\'" class="user-imgs"/>\';
}
add_shortcode(\'img\', \'image_code\');
所以当我使用这样的代码时:[img]https://www.google.com.br/images/srpr/logo3w.png[/img]
它只显示如下图像:(在css中,我已将.user imgs设置为最大宽度600px)<img src="https://www.google.com.br/images/srpr/logo3w.png">
但我想显示一个指向完整图像的链接,如下所示:<a href="https://www.google.com.br/images/srpr/logo3w.png"><img src="https://www.google.com.br/images/srpr/logo3w.png">
如何检索短代码中使用的图像url并将其用作原始图像的链接?