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
Add a comment  | 

1 Answer 1

Reset to default 0

Elegant 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
Add a comment  | 

1 Answer 1

Reset to default 0

Elegant 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.

本文标签: