Advertisements

img_caption_shortcode

Definition:
function img_caption_shortcode($attr, $content = null) {}

The Caption shortcode.
Allows a plugin to replace the content that would otherwise be returned. The filter is ‘img_caption_shortcode’ and passes an empty string, the attr parameter and the content parameter values.

Parameters

  • array $attr: Attributes attributed to the shortcode.
  • string $content: Optional. Shortcode content.

Defined filters

  • img_caption_shortcode
    apply_filters('img_caption_shortcode', '', $attr, $content)

Source code

function img_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: ' . (10 + (int) $width) . 'px">'

	. do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';

}

2005

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: