lundi 2 mars 2015

How might one programmatically set the link for all images in all posts?


Every post on my Wordpress site contains at least one image (in the content, not as an attachment). Each post also contains a custom field with a URL.


I'd like to programmatically modify all posts such that all <img /> tags within the post are wrapped with an anchor tag, pointing to the URL in that post's custom field.


I realize that this would be trivial with JavaScript, but I'd really prefer to do it at the PHP level if at all possible.


Thanks!





Aucun commentaire:

Enregistrer un commentaire