/* This removes the built-in caption shortcodes, and replaces them with XHTML-compliant, valid code */ remove_shortcode( 'caption' ); remove_shortcode('wp_caption'); function img_caption_shortcode_self($attr, $content = null) { // Allow plugins/themes to override the default caption template. $output = apply_filters('img_caption_shortcode_self', '', $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 ' '. $content . '' . $caption . ''; } add_shortcode('wp_caption', 'img_caption_shortcode_self'); add_shortcode('caption', 'img_caption_shortcode_self'); //CSS NEEDED FOR THIS TO WORK PROPERLY .wp-caption { text-align: center; padding-top: 4px; } .wp-caption img { margin: 0 auto; padding: 0; border: 0 none; } .wp-caption .wp-caption-text { display: block; font-size: 11px; line-height: 22px; margin: 0; padding: 0 3px 3px 0; color: #fff; text-align: center; }