<?php | |
/** | |
* Remove padding from captions | |
* | |
*/ | |
function be_caption_no_padding( $output, $attr, $content ) { | |
extract(shortcode_atts(array( | |
'id' => '', | |
'align' => 'alignnone', | |
'width' => '', | |
'caption' => '' | |
), $attr, 'caption')); | |
if ( 1 > (int) $width || empty($caption) ) | |
return $content; | |
if ( $id ) $id = 'id="' . esc_attr($id) . '" '; | |
return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="max-width: ' . (int) $width . 'px">' | |
. do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>'; | |
} | |
add_filter( 'img_caption_shortcode', 'be_caption_no_padding', 10, 3 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters