Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode('wp_caption', 'slim_img_caption_shortcode');
- add_shortcode('caption', 'slim_img_caption_shortcode');
- function slim_img_caption_shortcode($attr, $content = null) {
- // Allow plugins/themes to override the default caption template.
- $output = apply_filters('img_caption_shortcode', '', $attr, $content);
- if ( $output != '' )
- return $output;
- extract(shortcode_atts(array(
- 'id' => '',
- 'align' => 'alignnone',
- 'width' => '',
- 'caption' => ''
- ), $attr));
- if ( 1 > (int) $width || empty($caption) )
- return $content;
- if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
- $frame_width = 0; // frame width in pixels per side //
- return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '" style="width: ' . ( 2 * $framewidth + (int) $width) . 'px">'
- . do_shortcode( $content ) . <p class="wp-caption-text"> . $caption . '</p></div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement