admin管理员组文章数量:1431927
I'm just looking for a relatively simple way to modify the default output when a standard post image with a caption is linked somewhere (generally to another page), so that the caption is included in the link. It currently resides outside of the link tag so that it doesn't link like the image does.
I'll eventually be moving the caption up so it overlays the image. It's just awkward that the image will link properly to a separate page, but the caption (which will be the title of the page that the link points to) will not.
The default output is currently:
<div id="attachment_xxx" style="width: 480px" class="wp-caption alignnone">
<a href="/about/history-mission/">
<img class="size-medium wp-image-1679" src=".jpg" alt="" width="470" height="313" srcset="[multiple image sizes]" sizes="[proper sizes]">
</a>
<p id="caption-attachment-1679" class="wp-caption-text">History & Mission</p>
</div>
- Any way to get that p.wp-caption-text to slide into the 'a' tag with the image???
If there is no link added to a photo, it should just behave normally. I also thought about using a gallery, but didn't see a way to make each image a unique link to other pages.
NOTE: For now I'm using the classic editor (w/ TinyMCE Advanced). Not sure if I'll switch to Gutenberg yet, as that would open a TON of possibilities up to the client that I would have to account for & style appropriately. Because, you know, clients...
THANKS!
本文标签: Move Image Captions Inside Link (ltagt tag) if Added
版权声明:本文标题:Move Image Captions Inside Link (<a> tag) if Added 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745594757a2665408.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论