Image captions from azaozz. see #6812

git-svn-id: https://develop.svn.wordpress.org/trunk@8239 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-07-02 18:41:11 +00:00
parent 458399dd51
commit 45ac770299
13 changed files with 365 additions and 93 deletions

View File

@@ -350,6 +350,31 @@ function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = fals
return $html;
}
add_shortcode('wp_caption', 'wp_caption_shortcode');
function wp_caption_shortcode($attr, $content = null) {
// Allow plugins/themes to override the default caption template.
$output = apply_filters('wp_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="' . $id . '" ';
return '<dl ' . $id . 'class="wp_caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">'
. '<dt class="wp_caption_dt">' . $content . '</dt><dd class="wp_caption_dd">' . $caption . '</dd></dl>';
}
add_shortcode('gallery', 'gallery_shortcode');
function gallery_shortcode($attr) {