[wp-hackers] WordPress changes for responsive designs
Dino Termini
dino at duechiacchiere.it
Thu Mar 29 02:32:55 UTC 2012
That's what I do on my blog, and it works just fine ;)
/* Make images with captions fluid */
add_shortcode('caption', 'duechiacchiere_img_caption_shortcode');
function duechiacchiere_img_caption_shortcode($attr, $content = null) {
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="max-width: ' . $width . 'px">'
. do_shortcode( $content ) . '<p class="wp-caption-text">' . $caption . '</p></div>';
}
On Mar 28, 2012, at 10:23 PM, Ricardo Moraleida <moraleida at gmail.com> wrote:
> Overriding the styles on '.wp-caption' and '.wp-caption img' isn't solving
> it for you?
>
More information about the wp-hackers
mailing list