<?php
add_filter('image_send_to_editor', 'wpse_20160112_filter_image_send_to_editor', 11, 8);
function wpse_20160112_filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) {
$responsive_content = str_replace('class="', 'class="responsive ', $html);
return $responsive_content;
}
/* CSS
img.responsive {
width: 100%;
height: auto;
}
*/
Makes images added to the Visual Editor responsive by default. Be sure to have a class in place that adjusts the width.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.