alchymyth

caption with blockquote

Jan 25th, 2012
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. //change image caption output html from <p> to <blockquote> //
  2. add_filter('img_caption_shortcode', 'img_caption_shortcode_blockquote', 10, 3);
  3.  
  4. function img_caption_shortcode_blockquote($empty,$att = null,$cont= null) {
  5.  
  6. extract(shortcode_atts(array(
  7.         'id'    => '',
  8.         'align' => 'alignnone',
  9.         'width' => '',
  10.         'caption' => ''
  11.     ), $att));
  12.  
  13.     if ( 1 > (int) $width || empty($caption) )
  14.         return $cont;
  15.  
  16.     if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
  17.  
  18.     return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . (10 + (int) $width) . 'px">'
  19.     . do_shortcode( $cont ) . '<blockquote class="wp-caption-text">' . $caption . '</blockquote></div>';
  20. }
Advertisement
Add Comment
Please, Sign In to add comment