SHARE
TWEET

filter

alchymyth Jan 11th, 2012 1,097 Never
  1. add_filter('get_image_tag', 'add_image_frames', 10, 6);
  2. function add_image_frames($html, $id, $alt, $title, $align, $size) {
  3.         list($img_src, $width, $height) = image_downsize($id, $size);
  4.         $class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
  5.         $class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
  6.         $before = '<div class="image_frame align'.$align.' size-'.$size.'"><div style="background-image: url(\'' . esc_attr($img_src) . '\');"><span>';
  7.         $after = '</span></div></div>';
  8.         $html = $before . $html . $after;
  9.         return $html;
  10. }
RAW Paste Data
Top