[Resolved] Changing theme to GeneratePress Question about images?

Home Forums Support Changing theme to GeneratePress Question about images?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1125901
    byo

    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

    #1126273
    Tom
    Lead Developer
    Lead Developer

    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 300×300, 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 🙂

    #1126281
    byo

    Thank you very much the filters will help

    #1126970
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.