Created
October 26, 2011 14:02
Revisions
-
jasonreposa revised this gist
Oct 26, 2011 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ // Originally built for http://www.mybanktracker.com/bank-news/ function mbt_img_caption_shortcode($val, $attr, $content = null) { extract(shortcode_atts(array( 'id' => '', -
jasonreposa created this gist
Oct 26, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ function mbt_img_caption_shortcode($val, $attr, $content = null) { extract(shortcode_atts(array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ), $attr)); // if it contains a pipe character, we know it's ours if (strpos($caption, '|') === FALSE) { return; } $tokens = explode('|', $caption); $caption = array_shift($tokens); $href = implode('|', $tokens); if (!empty($href)) { $caption .= ' <a href="' . $href . '" rel="nofollow">source</a>'; } if ( 1 > (int) $width || empty($caption) ) return $content; if ( $id ) $id = 'id="' . esc_attr($id) . '" '; return '<div ' . $id . 'class="wp-caption ' . esc_attr($align) . '">' . do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>'; } // what is 10, 3 for? add_filter('img_caption_shortcode', 'mbt_img_caption_shortcode', 10, 3);