Enable lightbox function of WooCommerce in WordPress Themes
There are some WordPress themes on the market that do not support WooCommerce. If you still want to use these themes with WooCommerce, then some of the features of WooCommerce are not directly accessible.
For example, if you want to activate or integrate the lightbox function of WooCommerce in such a theme, you have to insert the following code into the functions.php.
Here is the link to the code in my Gist account on GitHub, where you can find the code:
https://gist.github.com/Perun/524dd5d6fef518f85bc5bcae57c99361
Just include this code in the functions.php of the active theme:
add_action( 'after_setup_theme', 'name_of_theme' );
function name_of_theme() {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
The name_of_theme
must be replaced by the name of the active theme. If you only need the Lightbox-function and not the zoom and the slider, just add_theme_support (' wc-product-gallery-lightbox');
.
Open Source Contribution posted via Utopian.io
Hey @vladimir-simovic I am @utopian-io. I have just super-voted you at 26% Power!
Suggestions https://utopian.io/rules
Achievements
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Thank you for the contribution. It has been approved.
[utopian-moderator]
Thank you @espoem.
upvote and resteem ^^