Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- remove_shortcode('wp_caption');
- remove_shortcode('caption');
- add_shortcode('wp_caption', 'top_caption_shortcode');
- add_shortcode('caption', 'top_caption_shortcode');
- //
- // move captions to top of image
- // alchymyth 2011
- //
- //reshuffling of the original caption shortcode in /wp-includes/media.php line 707
- //
- function top_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+ 10) . 'px">'
- . '<p class="wp-caption-text">' . $caption . '</p>'
- . do_shortcode( $content )
- . '</div>';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement