I’d really love to be able to conditionally apply a CSS class to link elements of images embedded into posts, but I can’t seem to figure this one out.
Basically what I’d like to achieve is to replace the default embedded image link that links the image to the full size version of itself to opening it in a colorbox.
I know I can achieve this with a bit of Javascript-trickery, but I’d love to figure out how to do this in the server side and then just attach the colorbox functionality in a straightforward manner.
So, is there a filter I should add or what’s the route to take here. Ideally I’d love to be able to write the code so that if a user embeds an image, the link opens the full size version in a colorbox but if the user specifies a custom link, it’ll work like a regular link. This shouldn’t be that hard.
Thanks a lot for any help in advance!