Last active
September 15, 2024 21:41
-
-
Save josialoos/04c46c462f25cc0c5305e118e2b4cb70 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
Don't work for me !