folks.
I need to put a piece of code after every post image (post attached image).
it’s something like this:
<img class="alignnone size-full wp-image-3079" src="https://wordpress.stackexchange.com/questions/228237/imgurl.jpg" alt="02" width="2592" height="1936">
<div>some piece of code here</div>
It will be a share button to share the image instead the post, so every image will need a custom code to share the image url.
There’s a way to do this?
1 Answer
Try get_image_tag filter:
add_filter('get_image_tag', function($html, $id, $alt, $title, $align, $size)
{
return $html . '<div>some piece of code here</div>';
}, 10, 6);
References:
- get_image_tag()
- get_image_send_to_editor()
- wp_ajax_send_attachment_to_editor()