Forked from josialoos/gist:04c46c462f25cc0c5305e118e2b4cb70
Created
September 15, 2024 21:41
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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