admin管理员组文章数量:1022712
I have 28 pictures uploaded to media library, each around 3mb. Wordpress has already created resized copies of those: thumbnails, medium and large. The pictures are used as Divi's Blurb module images on a given page. They are all being loaded full sized (even if I choose Large when picking an image for module). 28*3mb is a lot.
What I want, is to write a neaty function in functions.php (child theme), that will rewrite all requests for image urls ( e.g. IMG_4321.jpg
), only for this specific page, and only for blurb modules, to urls to those large sized images created by wp ( IMG_4321-683x1024.jpg
). Maybe there's a funciton used by themes for accessing images that I can hook into?
I imagine it would start as:
if( is_page('menu') ) {
}
But that's as far as I can go.
I have 28 pictures uploaded to media library, each around 3mb. Wordpress has already created resized copies of those: thumbnails, medium and large. The pictures are used as Divi's Blurb module images on a given page. They are all being loaded full sized (even if I choose Large when picking an image for module). 28*3mb is a lot.
What I want, is to write a neaty function in functions.php (child theme), that will rewrite all requests for image urls ( e.g. IMG_4321.jpg
), only for this specific page, and only for blurb modules, to urls to those large sized images created by wp ( IMG_4321-683x1024.jpg
). Maybe there's a funciton used by themes for accessing images that I can hook into?
I imagine it would start as:
if( is_page('menu') ) {
}
But that's as far as I can go.
Share Improve this question asked Apr 25, 2019 at 23:45 Danyl FilatovDanyl Filatov 1413 bronze badges 1- if the image weight is your problem (~3MB for one), you should use optimized/compressed images. either you can use plugin for that or you can manually compress images and upload – Vishwa Commented Apr 26, 2019 at 6:07
1 Answer
Reset to default 0Elegant Themes (Divi) recommend a maximum width of 550px for blurb images (https://www.elegantthemes/blog/divi-resources/the-ultimate-guide-to-using-images-within-divi). So you should be resizing your images according to those guidelines for the images that you know will be used in your blurbs. This will ensure that your images don't cause WordPress too much memory effort to resize them on the fly, and should also mean your images will have a smaller filesize too.
I have 28 pictures uploaded to media library, each around 3mb. Wordpress has already created resized copies of those: thumbnails, medium and large. The pictures are used as Divi's Blurb module images on a given page. They are all being loaded full sized (even if I choose Large when picking an image for module). 28*3mb is a lot.
What I want, is to write a neaty function in functions.php (child theme), that will rewrite all requests for image urls ( e.g. IMG_4321.jpg
), only for this specific page, and only for blurb modules, to urls to those large sized images created by wp ( IMG_4321-683x1024.jpg
). Maybe there's a funciton used by themes for accessing images that I can hook into?
I imagine it would start as:
if( is_page('menu') ) {
}
But that's as far as I can go.
I have 28 pictures uploaded to media library, each around 3mb. Wordpress has already created resized copies of those: thumbnails, medium and large. The pictures are used as Divi's Blurb module images on a given page. They are all being loaded full sized (even if I choose Large when picking an image for module). 28*3mb is a lot.
What I want, is to write a neaty function in functions.php (child theme), that will rewrite all requests for image urls ( e.g. IMG_4321.jpg
), only for this specific page, and only for blurb modules, to urls to those large sized images created by wp ( IMG_4321-683x1024.jpg
). Maybe there's a funciton used by themes for accessing images that I can hook into?
I imagine it would start as:
if( is_page('menu') ) {
}
But that's as far as I can go.
Share Improve this question asked Apr 25, 2019 at 23:45 Danyl FilatovDanyl Filatov 1413 bronze badges 1- if the image weight is your problem (~3MB for one), you should use optimized/compressed images. either you can use plugin for that or you can manually compress images and upload – Vishwa Commented Apr 26, 2019 at 6:07
1 Answer
Reset to default 0Elegant Themes (Divi) recommend a maximum width of 550px for blurb images (https://www.elegantthemes/blog/divi-resources/the-ultimate-guide-to-using-images-within-divi). So you should be resizing your images according to those guidelines for the images that you know will be used in your blurbs. This will ensure that your images don't cause WordPress too much memory effort to resize them on the fly, and should also mean your images will have a smaller filesize too.
本文标签:
版权声明:本文标题:functions - (Divi): How to make Wordpress load images of specific size for Blurb modules on given page with a funciton? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745550133a2155592.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论