I'm trying to get rid of the function where users can hover over the main product image and zoom into the product. I tried using this code, which has been confirmed by others to work, but nothing changed.
function remove_image_zoom_support() { remove_theme_support( 'wc-product-gallery-zoom' );}add_action( 'wp', 'remove_image_zoom_support', 100 );
Is this because some other function I'm using is interfering with it?
Here is my functions file:
<?phpadd_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );function my_theme_enqueue_styles() { $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme. wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ), wp_get_theme()->get('Version') ); wp_enqueue_style( 'my-google-fonts', 'http://fonts.googleapis.com/css?family=Lekton', false );}//* Redirect archive pages to the home pagefunction redirect_to_home( $query ){ if(is_archive() ) { wp_redirect( home_url() ); exit; }}add_action( 'parse_query', 'redirect_to_home' );//* Add CPT taxonomy terms to body classfunction add_taxonomy_to_single( $classes ) { if ( is_single() ) { global $post; $my_terms = get_the_terms( $post->ID, 'skill' ); if ( $my_terms && ! is_wp_error( $my_terms ) ) { foreach ($my_terms as $term) { $classes[] = $term->slug; } } } return $classes;}add_filter( 'body_class', 'add_taxonomy_to_single' );//* Add page slug body classfunction add_slug_body_class( $classes ) { global $post; if ( isset( $post ) ) { $classes[] = $post->post_type . '-' . $post->post_name; } return $classes;}add_filter( 'body_class', 'add_slug_body_class' );//* Unload Gutenberg Block Editoradd_action( 'wp_print_styles', 'wps_deregister_styles', 100 );function wps_deregister_styles() { wp_dequeue_style( 'wp-block-library' );}//* Use Google's jQueryadd_action('init', 'use_jquery_from_google');function use_jquery_from_google () { if (is_admin()) { return; } global $wp_scripts; if (isset($wp_scripts->registered['jquery']->ver)) { $ver = $wp_scripts->registered['jquery']->ver; } else { $ver = '3.4.0'; } wp_deregister_script('jquery'); wp_register_script('jquery', "//ajax.googleapis.com/ajax/libs/jquery/$ver/jquery.min.js", false, $ver);}//* Remove Testimonials post typeadd_action( 'init', 'remove_testimonial_cpt', 1000 );function remove_testimonial_cpt() { unregister_post_type( 'testimonial' );}//* Remove WYSIWYG editor from productsadd_action('init', 'init_remove_support',100);function init_remove_support(){ $post_type = 'product'; remove_post_type_support( $post_type, 'editor');}//* Change gallery thumbnail sizesadd_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) { return array('width' => 132,'height' => 162,'crop' => 0, );});//* Remove Proceed to Checkout button on Cart pageremove_action( 'woocommerce_proceed_to_checkout','woocommerce_button_proceed_to_checkout', 20);//* Remove thumbnails from Cart pageadd_filter( 'woocommerce_cart_item_thumbnail', '__return_false' );//* Remove results count and dropdown on main shop pageremove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );//* Remove additional information tab on single shop pageadd_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );function woo_remove_product_tabs( $tabs ) { unset( $tabs['additional_information'] ); return $tabs;}//* Add gallery captions for shop itemsfunction gcw_insert_captions( $html, $attachment_id ) { $captions = ''; $title = get_post_field( 'post_title', $attachment_id ); if( !empty( $title ) ) { $captions .= '<h3>' . esc_html( $title ) . '</h3>'; } if( !empty( $captions ) ) { $captions = '<div class="gcw-caption">' . $captions . '</div>'; $html = preg_replace('~<\/div>$~', $captions . '</div>', $html ); } return $html;}add_filter( 'woocommerce_single_product_image_thumbnail_html', 'gcw_insert_captions', 10, 2 );//* Remove hover zoomfunction remove_image_zoom_support() { remove_theme_support( 'wc-product-gallery-zoom' );}add_action( 'wp', 'remove_image_zoom_support', 100 );?>
If not, what could be causing this issue?