
filter
By:
alchymyth on
Jan 11th, 2012 | syntax:
PHP | size: 0.58 KB | hits: 402 | expires: Never
add_filter('get_image_tag', 'add_image_frames', 10, 6);
function add_image_frames($html, $id, $alt, $title, $align, $size) {
list($img_src, $width, $height) = image_downsize($id, $size);
$class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
$before = '<div class="image_frame align'.$align.' size-'.$size.'"><div style="background-image: url(\'' . esc_attr($img_src) . '\');"><span>';
$after = '</span></div></div>';
$html = $before . $html . $after;
return $html;
}