Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * move captions to right of image
- */
- add_shortcode('wp_caption', 'fixed_img_caption_shortcode');
- add_shortcode('caption', 'fixed_img_caption_shortcode');
- function fixed_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) . '" ';
- return '<div ' . $id . 'class="wp-caption ' . esc_attr($align)
- . '" style="width: ' . ((int) $width+ 299 + 20) . 'px"><span style="float:left;">'
- . do_shortcode( $content )
- . '</span><p style="float:right; width: 301px;" class="wp-caption-text">'
- . $caption
- . '</p><span style="float:none;clear:both;display:block;"></span></div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement