Skip to content

Instantly share code, notes, and snippets.

@michaelmusgrove
Created March 25, 2013 05:33
Show Gist options
  • Save michaelmusgrove/5235131 to your computer and use it in GitHub Desktop.
Save michaelmusgrove/5235131 to your computer and use it in GitHub Desktop.
Make Images Responsive in WordPress
function responsive_images($atts, $content = null) {
return '<div class="image-resized">' . $content .'</div>';
}
add_shortcode('responsive', 'responsive_images');
@media only screen and (max-width:767px) {
.image-resized img {
width:100%;
height:auto;
}
}
[responsive]<img src="image_url" alt="alt" title="title" />[/responsive]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment