How to get dynamically attachment image url for tag?
-
So, below is the WordPress default generated code for an image:
<div class="image-section"> <a href="https://websitename.com/wp-content/uploads/2019/06/image-1.jpg" target="_blank" rel="noopener noreferrer"> <img src="https://websitename.com/wp-content/uploads/2019/06/image-1.jpg"/></a></div> <div class="image-section"> <a href="https://websitename.com/wp-content/uploads/2019/06/image-2.jpg" target="_blank" rel="noopener noreferrer"> <img src="https://websitename.com/wp-content/uploads/2019/06/image-2.jpg"/></a></div>
I have no idea to get image attachment link for a tag
I can’t change URL for each image, Is there any possibilities to get the attachment link for
<a>
instead of the image URLThis is what I am expecting
<div class="image-section"> <a href="current_image_attachment_url" target="_blank" rel="noopener noreferrer"> <img src="https://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="https://websitename.com/wp-content/uploads/2019/06/image-2.jpg"/></a></div>
Thank you in advance, if you can help me.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to get dynamically attachment image url for tag?’ is closed to new replies.