Archived topic
Changing theme to GeneratePress Question about images?
3 replies · Started by byo on January 8, 2020
Hi,
I asked you this question using the presale contact form, meantime i bought the premium version, moving discussion to support forum,
I moved my website from avada to Generatepress,
Avada is generating a lot of images sizes, i already disabled some of them,
so my theme left with this:
Wp: 3 image sizes
Avada: 4 image sizes
So my question, is what should i do know?
try to keep this image sizes
or use only 2 or 3 sizes and resize them to fit on columns used on my website (my prefered choice=> more speed and less images in the server)
My first concern is Google image, and the impact of changing images sizes on already indexed images!
I need some advices
Regards
Hi there,
Having images on your server is ok, as long a they're not all being linked to from your pages.
So let's say Avada had an image size of 300x300, you can create your own size like this:
add_action( 'after_setup_theme', function() {
add_image_size( 'your-archive-image-handle', 300, 300, true );
add_image_size( 'your-single-image-handle', 500, 200 );
} );
Now, you can tell GeneratePress to use this image size on its archives like this:
add_filter( 'generate_page_header_default_size', function( $size ) {
// Tell archives to use 300x300 cropped (true)
if ( is_archive() ) {
return 'your-archive-image-handle';
}
// Tell single posts to use 500x200 not cropped (no true)
if ( is_single() ) {
return 'your-single-image-handle';
}
return $size;
} );
Let me know if you need more info :)
Thank you very much the filters will help
You're welcome :)