Created
March 25, 2013 05:33
-
-
Save michaelmusgrove/5235131 to your computer and use it in GitHub Desktop.
Make Images Responsive in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function responsive_images($atts, $content = null) { | |
return '<div class="image-resized">' . $content .'</div>'; | |
} | |
add_shortcode('responsive', 'responsive_images'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media only screen and (max-width:767px) { | |
.image-resized img { | |
width:100%; | |
height:auto; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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