因此,以下是Wordpress为图像生成的默认代码:
<div class="image-section">
<a href="http://websitename.com/wp-content/uploads/2019/06/image-1.jpg" target="_blank" rel="noopener noreferrer">
<img src="http://websitename.com/wp-content/uploads/2019/06/image-1.jpg"/>
</a>
</div>
<div class="image-section">
<a href="http://websitename.com/wp-content/uploads/2019/06/image-2.jpg" target="_blank" rel="noopener noreferrer">
<img src="http://websitename.com/wp-content/uploads/2019/06/image-2.jpg"/>
</a>
</div>
我不知道要获取标签的图像附件链接
我无法更改每个图像的URL,是否有可能获得<a>
的附件链接而不是图像URL
这是我的期望
<div class="image-section">
<a href="current_image_attachment_url" target="_blank" rel="noopener noreferrer">
<img src="http://websitename.com/wp-content/uploads/2019/06/image-1.jpg"/>
</a>
</div>
<div class="image-section">
<a href="current_image_attachment_url" target="_blank" rel="noopener noreferrer">
<img src="http://websitename.com/wp-content/uploads/2019/06/image-2.jpg"/>
</a>
</div>