All Categories Product Gallery Slider Hooks: Actions and Filters

Hooks: Actions and Filters

hooks for developers :)

By Niloy
December 13, 2020

Hide Featured Image from Gallary

add_filter( 'wpgs_show_featured_image_in_gallery', '__return_false', 20 );

Add class into main wrapper via filter

add_filter('wpgs_wrapper_add_classes','wpgs_no_gallery_class' , 20 ,2);

function wpgs_no_gallery_class($class , $attachment_ids){
    return ' new-class' ;
}

Hide Featured image from thumbnail gallery .

Note: this filter will only work when lightbox for thumbnails is activated.

add_filter( 'wpgs_show_featured_image_in_gallery', '__return_false', 20 );

Some themes or plugins are set large size for woocommerce_gallery_thumbnail image size or use this to other area. so in this case you can set your own image size .

add_filter('wpgs_new_thumb_img_size','my_new_thumbnail_size' , 20);

function my_new_thumbnail_size($size){
    return 'prefix_my_thumb_size' ;
}
add_image_size( 'prefix_my_thumb_size', 100, 100, true ); // 100 pixels wide by 100 pixels tall, hard crop mode

Change lightbox image size

add_filter('gallery_slider_lightbox_image_size','my_new_lightbox_size' , 20);

function my_new_lightbox_size($size){
    return 'large';
}

Change Image Zoom image size

add_filter('gallery_slider_zoom_image_size','my_new_zoom_image_size' , 20);

function my_new_zoom_image_size($size){
    return 'full';
}

more about the image size: https://developer.wordpress.org/reference/functions/add_image_size/

please let us know if you think we need to add any new hooks :)

Was this article helpful?