admin管理员组文章数量:1289383
Excellent WordPress programmers, I'd like to resolve an image issue with my WordPress theme. I tried everything I could, but I couldn't find a solution.
The issue is that my added blog posts images are not responsive. While my feature image is responsive since it has the tag <picture class="c-picture">
. If I add <picture class="c-picture">
manual to the images it, fixes it.
Example:
<picture class="c-picture"><img loading="lazy" class="alignnone wp-image-160 size-full" src="/wp-content/uploads/2021/06/20210617_164346.jpg?resize=2048%2C2048&ssl=1" alt="" width="2048" height="2048" srcset="/wp-content/uploads/2021/06/20210617_164346.jpg?w=2048&ssl=1 2048w, /wp-content/uploads/2021/06/20210617_164346.jpg?resize=300%2C300&ssl=1 300w, /wp-content/uploads/2021/06/20210617_164346.jpg?resize=1024%2C1024&ssl=1 1024w, /wp-content/uploads/2021/06/20210617_164346.jpg?resize=150%2C150&ssl=1 150w, /wp-content/uploads/2021/06/20210617_164346.jpg?resize=768%2C768&ssl=1 768w, /wp-content/uploads/2021/06/20210617_164346.jpg?resize=1536%2C1536&ssl=1 1536w, /wp-content/uploads/2021/06/20210617_164346.jpg?resize=1568%2C1568&ssl=1 1568w" sizes="(max-width: 1000px) 100vw, 1000px" data-recalc-dims="1"></picture>
So my question is, can I have a function that will add <picture class="c-picture">
to all blog posts images. Thank you, guys. Post link: /
Excellent WordPress programmers, I'd like to resolve an image issue with my WordPress theme. I tried everything I could, but I couldn't find a solution.
The issue is that my added blog posts images are not responsive. While my feature image is responsive since it has the tag <picture class="c-picture">
. If I add <picture class="c-picture">
manual to the images it, fixes it.
Example:
<picture class="c-picture"><img loading="lazy" class="alignnone wp-image-160 size-full" src="https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?resize=2048%2C2048&ssl=1" alt="" width="2048" height="2048" srcset="https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?w=2048&ssl=1 2048w, https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?resize=300%2C300&ssl=1 300w, https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?resize=1024%2C1024&ssl=1 1024w, https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?resize=150%2C150&ssl=1 150w, https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?resize=768%2C768&ssl=1 768w, https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?resize=1536%2C1536&ssl=1 1536w, https://i1.wp/sololoaded/wp-content/uploads/2021/06/20210617_164346.jpg?resize=1568%2C1568&ssl=1 1568w" sizes="(max-width: 1000px) 100vw, 1000px" data-recalc-dims="1"></picture>
So my question is, can I have a function that will add <picture class="c-picture">
to all blog posts images. Thank you, guys. Post link: https://sololoaded/nigerian-music-artists-who-were-born-rich/
1 Answer
Reset to default 1I think in your case you can do it using css by adding the height: auto; to image tags:
.c-entry-content img { max-width: 100%; height: auto; }
本文标签: theme developmentHow can I wrap all blog posts image with ltpicture classquotcpicturequotgt
版权声明:本文标题:theme development - How can I wrap all blog posts image with <picture class="c-picture"> 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741430890a2378350.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论