• Resolved logicindustries

    (@logicindustries)


    I’m trying to add support for WooCommerce 3.X gallery zoom and slider into the function.php of this theme via the following code:

    add_action( 'after_setup_theme', 'oblique_setup' );
     
    function oblique_setup() {
        add_theme_support( 'wc-product-gallery-zoom' );
        add_theme_support( 'wc-product-gallery-lightbox' );
        add_theme_support( 'wc-product-gallery-slider' );
    }

    This added code does indeed make the WooCommerce gallery et al function as it should, but its inclusion in the functions.php file (anywhere in the file, I’ve tried to put it several different places, and the result is always the same) breaks the social menu (removes it entirely, actually).

    With the new code, the social menu (and all support for menus generally, it seems) is stripped from the theme.

    Reverting back to the old code restores the social menu, but obviously does away with the WooCommerce gallery functionality that I’m after.

    I’m not a programmer or any sort of web designer, I’m a machinist by trade, so bear that in mind when you answer.

    I’m way out of my depth here, and could really use some help unscrewing the situation. I just don’t understand why that code snippet makes one thing work and another disappear. It’s not obvious why it would break anything to do with the menu system.

    Please help.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter logicindustries

    (@logicindustries)

    I figured the problem out, or rather I figure out how to do what I wanted to do without breaking anything else.

    I still don’t know why what I was doing before was breaking things, but it doesn’t matter.

    Instead of editing the Functions.php file, I instead edited the woocommerce.php file.

    I changed this bit of code:

    /**
     * Declare WooCommerce Support
     */
    function oblique_woocommerce_support() {
    	add_theme_support( 'woocommerce' );
    }
    add_action( 'after_setup_theme', 'oblique_woocommerce_support' );
    

    To this:

    /**
     * Declare WooCommerce Support
     */
    function oblique_woocommerce_support() {
    	add_theme_support( 'woocommerce' );
    	add_theme_support( 'wc-product-gallery-zoom' );
        add_theme_support( 'wc-product-gallery-lightbox' );
        add_theme_support( 'wc-product-gallery-slider' );
    }
    add_action( 'after_setup_theme', 'oblique_woocommerce_support' );
    

    And then after test driving, I decided that I didn’t want the ZOOM function active anymore, so I commented it out:

    /**
     * Declare WooCommerce Support
     */
    function oblique_woocommerce_support() {
    	add_theme_support( 'woocommerce' );
    	/**add_theme_support( 'wc-product-gallery-zoom' );*/
        add_theme_support( 'wc-product-gallery-lightbox' );
        add_theme_support( 'wc-product-gallery-slider' );
    }
    add_action( 'after_setup_theme', 'oblique_woocommerce_support' );
    

    That solved my problem.

    I’ve now got full image lightbox and slider functionality, but my social menu hasn’t disappeared like before.

    I’m calling it a win and quitting while I’m ahead.

    Just came back here to document the fix in case anyone else happens to need to perform it themselves.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding Support for WooCommerce 3.0+ Gallery Zoom Slider Breaks Social Menu’ is closed to new replies.