Skip to content

Instantly share code, notes, and snippets.

@mkdizajn
mkdizajn / function.php
Last active May 6, 2020 15:59
Wordpress Bootstrap 3 responsive images
<?php
//----------------------------------------------------------/
// responsive images [ 1) add img-responsive class 2) remove dimensions ]
//----------------------------------------------------------/
function bootstrap_responsive_images( $html ){
$classes = 'img-responsive'; // separated by spaces, e.g. 'img image-link'
// check if there are already classes assigned to the anchor
if ( preg_match('/<img.*? class="/', $html) ) {