• Resolved george18sa

    (@george18sa)


    I put the following code into a must-use plugin having replaced ‘yourtheme’ with the name of our theme and nothing happens.

    What could I be doing wrong?

    Thanks!

    `add_action( ‘after_setup_theme’, ‘yourtheme_setup’ );

    function yourtheme_setup() {
    add_theme_support( ‘wc-product-gallery-zoom’ );
    add_theme_support( ‘wc-product-gallery-lightbox’ );
    add_theme_support( ‘wc-product-gallery-slider’ );
    }

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

Viewing 15 replies - 1 through 15 (of 19 total)
  • AJ a11n

    (@amandasjackson)

    `<?php add_action( ‘after_setup_theme’, ‘yourtheme_setup’ );

    function yourtheme_setup() {
    add_theme_support( ‘wc-product-gallery-zoom’ );
    add_theme_support( ‘wc-product-gallery-lightbox’ );
    add_theme_support( ‘wc-product-gallery-slider’ );
    }
    ?>

    You should add in the code in your functions.php file below the line where it says “add_action”.

    If you’re uncomfortable working with the functions.php file, recommend using the following plugin to manage your snippets:
    https://www.ads-software.com/plugins/code-snippets/

    Thread Starter george18sa

    (@george18sa)

    I was hoping to do that in a way that would not be affected during upgrading the theme.

    Thread Starter george18sa

    (@george18sa)

    But that plugin looks perfect. Thanks!

    Thread Starter george18sa

    (@george18sa)

    I added it in and there was a conflict with the mu-plugin code which implies to me that mu-plugin code should work. I’ll remove the code in the mu-plugin anyway and try it.

    Thread Starter george18sa

    (@george18sa)

    No.. it still didn’t work.

    add_action( ‘after_setup_theme’, ‘ArtToCanvas_setup’ );

    function ArtToCanvas_setup() {
    //add_theme_support( ‘wc-product-gallery-zoom’ );
    add_theme_support( ‘wc-product-gallery-lightbox’ );
    add_theme_support( ‘wc-product-gallery-slider’ );
    }

    Thread Starter george18sa

    (@george18sa)

    This is version 3.4.1 on WordPress 4.9.6

    If you copied and pasted that code snippet as it is, it has typographer’s quotes rather than straight quotes so I would encourage you to take a look and ensure that the quote marks are all straight quotes rather than typographer’s quotes.

    Thread Starter george18sa

    (@george18sa)

    I made sure that it has straight quotes and it still doesn’t work. Thanks for thinking of that but it’s not that.

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @george18sa Deactivate Autoptimize and see if that fixes it, there are JavaScript errors on your product page that may be due to many JavaScript files being condensed into one.

    pro-tip; you can disable Autoptimize on a per-request basis by adding ?ao_noptimize=1 to the URL.

    if the problem is not there at that point, some autoptimize (re-)configuration might be needed to fix this. there’s more info in the troubleshooting tips and info on exclusions in the AO FAQ.

    hope this helps debugging,
    frank (ao dev)

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    ^^ That didn’t fix it, but it removed the JS errors.

    Thread Starter george18sa

    (@george18sa)

    I just installed AutoOptimize recently—this was happening before.

    And I noticed the javascript errors. It’s just the way the site was put together (before I showed up) that’s so bulky and shows up terribly on GTMetrix.

    So I’ll turn it off again for now to lose those errors but what can I do to fix that gallery? ??

    Taking at look at this. It looks like this is an issue with the theme. Can you supply the status page from Woo?

    WooCommerce > Status and copy/paste that log here? I have a feeling the theme is overriding the template and removing what actually allows it to work.

    Regardless if that function/filter is active and tells WooCommerce that it can do it. If the template has been either overridden or modified via actions/filters it simply will not function.

    If you change your theme to say Storefront or Twentyseventeen does the lightbox work?

    Thread Starter george18sa

    (@george18sa)

    This is what I get : 2018-06-07T14:50:06+00:00 CRITICAL Allowed memory size of 268435456 bytes exhausted (tried to allocate 1048577 bytes)

    Thread Starter george18sa

    (@george18sa)

    Also, this wordpress installation is so heavily customized that I’m afraid to change the theme.

    However, there is this : the theme contains outdated files even though I have updated Woocommerce to 3.4.1. Could this be the problem?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Lightbox not working despite added code’ is closed to new replies.