Support » Plugin: Simple Responsive Images » Won't work with captioned images

Viewing 1 replies (of 1 total)
  • Cormac Bracken

    (@the_other_mac)

    I put this code into my regular functions.php, which stops WP from putting width attributes on the div.

    add_filter( 'img_caption_shortcode', 'rhl_remove_caption_dimensions', 10, 3 );
    
    	function rhl_remove_caption_dimensions ( $val, $attr, $content = null )
    		{
    				extract(shortcode_atts(array(
    					'id'	=> '',
    					'align'	=> '',
    					'width'	=> '',
    					'caption' => ''
    				), $attr));
    
    			if ( empty($caption) )
    			return $val;
    
    			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>';
    		}

    There’s still an issue with using the visual editor. Inserting an image in visual mode just inserts regular thumbnail code, not the SRI code. And switching from html editor to visual and back, the SRI code is lost.

Viewing 1 replies (of 1 total)
  • The topic ‘Won't work with captioned images’ is closed to new replies.