==== Usage ==== [img=myimg] my caption [/img] all the conventional img attributes should work (scale=nn% etc.) to link the image to an external resource do not wrap the [img][/img] into a [url][/url] but use instead the url attribute of the extended img tag : [img=myimg.jpg url=http://example.com] caption [/img] to customize behaviour define .floatright .floatleft .center in your CSS, here's an example .floatleft { float:left; padding-right:10px; text-align:left; } .floatright { float:right; padding-left:10px; text-align:right; } .center { text-align:center; } .img-container { font-size: small; font-style:italic; font-family: serif; } .img-container p { margin-top: 0; } there is finally an align= attribute which forces the container to left|right|center align the text of the img container have fun! ==== Code ==== $img"; return '
' . "

$img

\n\n{$content}\n\n
"; } function &plugin_extendedimg_init() { static $bbcode; if ($bbcode) return $bbcode; $bbcode = new StringParser_BBCode (); // If you set it to false the case-sensitive will be ignored for all codes $bbcode->setGlobalCaseSensitive (false); $bbcode->setMixedAttributeTypes(true); $bbcode->addCode ( 'img', 'callback_replace', 'plugin_extendedimg_callback', array ('usecontent_param' => array ('default', 'float', 'alt', 'popup', 'width', 'height', 'title') ), 'image', array ('block', 'inline'), array ()); $bbcode->setCodeFlag ('img', 'closetag', BBCODE_CLOSETAG_MUSTEXIST); return $bbcode; } function plugin_extendedimg_parse($string) { $o = plugin_extendedimg_init(); return $o->parse($string); } add_filter('the_content', 'plugin_extendedimg_parse', 0); ?>