Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Free269 on "How do I add A Div around each WordPress post image ?"

$
0
0

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-image

Someone 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 all articles
Browse latest Browse all 8245

Trending Articles