Hi
I'm coding a new theme for an existing site and there is a requirement to have post images wit a CSS3 page curl drop shadow like so
http://www.cssplay.co.uk/menu/css3-photo-curl.html
this requires to wrap the images with 2 tags. there is a function that works for new images being inserted:
</b>';
/* wrap images with span */
if(is_admin()){
add_filter('image_send_to_editor', 'wrap_my_div', 10, 8);
function wrap_my_div($html, $id, $caption, $title, $align, $url, $size, $alt){
return '<b class="curl"><b>'.$html.'
}
}
but I need to apply this to existing posts if possible. So is there a way to do that?
thanks
Luis Abarca answers:
Yep, just check the css clases, you mean the images in the post content right ?
[[LINK href="http://codex.wordpress.org/Wrapping_Text_Around_Images"]]http://codex.wordpress.org/Wrapping_Text_Around_Images[[/LINK]]
You can also flter the_content and add the code for each images
function filter_images($content){
return preg_replace('/<img (.*) \/>\s*/iU', '<b class="curl"><img \1 /></b>', $content);
}
add_filter('the_content', 'filter_images');
Im runing this code here [[LINK href="http://dev.justoalblanco.com/2011/09/27/hola-mundo/"]]http://dev.justoalblanco.com/2011/09/27/hola-mundo/[[/LINK]], notice the code in the image
or with jQuery :
$('article img').wrap('<b class="curl"></b>');
paul de wouters comments:
thanks that did the trick!