How do I add A Div around each WordPress post image ?
-
I want to add a div around every image that is posted on my wordpress blog post. How can I do it?
(For the curious ones, I’m attempting to pop out some share buttons whenever a user hovers over an image).
This is an example of what I want to do:
http://jsfiddle.net/vzurqnvo/
It’s more that wrapping it with a div, after the image there are other things.
My unanswered post on stackoverflow:
http://stackoverflow.com/questions/25403001/how-do-i-add-a-div-around-each-wordpress-post-imageSomeone suggested me to add this to functions.php and it didn’t work:
add_filter( 'image_send_to_editor', 'wp_image_wrap_init', 10, 8 ); function wp_image_wrap_init( $html, $id, $caption, $title, $align, $url, $size, $alt ) { return '<div id="wp-image-wrap-'. $id .'" class="wp-image-wrap">'. $html .'</div>'; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How do I add A Div around each WordPress post image ?’ is closed to new replies.