So I’m working on a new theme, and I’m having trouble getting the images to be responsive.I tried using this script, but for some reason cannot get it to work: https://github.com/joshje/Responsive-Enhance
More info on this method: http://keirwhitaker.com/archive/automatic-responsive-images-in-wordpress/
<?php $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium'); $full = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?> <img id="responsive-image" alt="<?php the_title(); ?>" src="<?php echo $thumb; ?>" data-fullsrc="<?php echo $full; ?>" />
<script> responsiveEnhance(document.getElementById('responsive-image'), 400); </script>
And yes, I enqueued the .js file and it is working correctly.. yet it’s not loading the correct image size.
Does anybody have any idea what I might be doing wrong? Or maybe there’s another better way to do responsive images in WP themes? I just want to make sure that I don’t use a responsive solution that loads the full resolution image on mobile devices or tablets instead of a smaller version..
Any help would be greatly appreciated!