Advertisement
hmbashar

Add Supports Script for Woocommerce Gallery

Jan 8th, 2024
923
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. function abc_woocommerce_gallery_support() {
  2.     // Include the file for is_plugin_active() function
  3.     include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
  4.  
  5.     // Check if WooCommerce is active
  6.     if ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
  7.         // Check and add theme support for each feature
  8.         if ( ! current_theme_supports( 'wc-product-gallery-zoom' ) ) {
  9.             add_theme_support( 'wc-product-gallery-zoom' );
  10.         }
  11.         if ( ! current_theme_supports( 'wc-product-gallery-slider' ) ) {
  12.             add_theme_support( 'wc-product-gallery-slider' );
  13.         }
  14.         if ( ! current_theme_supports( 'wc-product-gallery-lightbox' ) ) {
  15.             add_theme_support( 'wc-product-gallery-lightbox' );
  16.         }
  17.     }
  18. }
  19.  
  20. add_action( 'after_setup_theme', 'abc_woocommerce_gallery_support' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement