Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save koniklos/17f0ef929881aaa116771ad2f9adf15f to your computer and use it in GitHub Desktop.

Select an option

Save koniklos/17f0ef929881aaa116771ad2f9adf15f to your computer and use it in GitHub Desktop.
Woocommerce: Activate image gallery features on archive page same as on product page
Add this to your functions.php in wordpress theme folder:
add_action( 'wp_enqueue_scripts', 'gallery_scripts', 20 );
function gallery_scripts() {
if ( is_archive()) {
if ( current_theme_supports( 'wc-product-gallery-zoom' ) ) {
wp_enqueue_script( 'zoom' );
}
if ( current_theme_supports( 'wc-product-gallery-slider' ) ) {
wp_enqueue_script( 'flexslider' );
}
if ( current_theme_supports( 'wc-product-gallery-lightbox' ) ) {
wp_enqueue_script( 'photoswipe-ui-default' );
wp_enqueue_style( 'photoswipe-default-skin' );
add_action( 'wp_footer', 'woocommerce_photoswipe' );
}
wp_enqueue_script( 'wc-single-product' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment