I’ve created a new custom post type and I need the post thumbnails or featured images generated by the get_the_post_thumbnail()
function to be set in percent, rather than pixels, as I’m using a fluid grid. Ideally I would only set the width (to 100%). Is there a way to do this? Potentially using add_image_size()
?
Leave a Reply
You must be logged in to post a comment.
have you tried,
It’s not possible to change the units of the default width and height output, but you can possibly override the output via css:
Then you can override it via something like
body img.attachment-large { width: 50% !important; height: 50% !important; }
I’ve solved that issue getting rid of all width and height attributes set by WP: