Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

filter

By: alchymyth on Jan 11th, 2012  |  syntax: PHP  |  size: 0.58 KB  |  views: 772  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }